- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/concurrency/examples/FibRefactor.py
r90b9e4b re73d449 1 def Fib onacci():1 def Fib(): 2 2 def Refactor(): 3 nonlocal fn, fn1 , fn23 nonlocal fn, fn1 4 4 fn = 0; fn1 = fn 5 5 yield fn # suspend 6 6 7 def Refactor2(): 7 8 nonlocal fn, fn1, fn2 … … 14 15 fn = fn1 + fn2; fn2 = fn1; fn1 = fn; yield fn 15 16 16 f1 = Fib onacci()17 f2 = Fib onacci()17 f1 = Fib() 18 f2 = Fib() 18 19 for i in range( 10 ): 19 20 print( next( f1 ), next( f2 ) ) # resume
Note: See TracChangeset
for help on using the changeset viewer.