next up previous [pdf]

Next: Final thoughts Up: Integrating Python with SCons Previous: Modules

Classes

The least used, but most powerful part of Python that you can bring into your SConstructs are Python classes. For example, if you are writing a script to process multiple models in the exact same way, but that have different parameters you would have to write separate Flow statements to process each of them, OR you could write a Python class that takes the model parameters and uses those parameters to generate Flow statements automatically, similar to functions. However, a class can allow you to group functions together into a single coherent body and allow you to drastically reduce the amount of code that must be reused.

We refer the reader to the Python documentation for more information on creating and using classes.




2011-11-03