source: doc/papers/concurrency/examples/Fib.py @ e7fdd76

ADTarm-ehast-experimentalcleanup-dtorsenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since e7fdd76 was e73d449, checked in by Peter A. Buhr <pabuhr@…>, 6 years ago

formatting

  • Property mode set to 100644
File size: 328 bytes
RevLine 
[e73d449]1def Fib():
[2e041e27]2        fn = 0; fn1 = fn; yield fn  # suspend
3        fn = 1; fn2 = fn1; fn1 = fn; yield fn
4        while True:
5                fn = fn1 + fn2; fn2 = fn1; fn1 = fn; yield fn
6
7
8
[e73d449]9f1 = Fib()
10f2 = Fib()
[2e041e27]11for i in range( 10 ):
12        print( next( f1 ), next( f2 ) )  # resume
13
14# Local Variables: #
15# tab-width: 4 #
16# compile-command: "python3.5 Fib.py" #
17# End: #
Note: See TracBrowser for help on using the repository browser.