This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Using generator functions to represent simulations | |
================================================== | |
A quick example of how to model a long/complex calculation using a generator function (a function containing | |
'yield') in Python. In the example below, we set-up a calculation; get intermediate results from it; send | |
new data to it, and - using a new feature in Python 3.13 - get a finished result at the end. | |
Ultimately, do what's clearest, and easiest to understand and maintain. |