Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/papers/concurrency/examples/FibRefactor.py

    re73d449 r90b9e4b  
    1 def Fib():
     1def Fibonacci():
    22        def Refactor():
    3                 nonlocal fn, fn1
     3                nonlocal fn, fn1, fn2
    44                fn = 0; fn1 = fn
    55                yield fn                                                # suspend
    6 
    76        def Refactor2():
    87                nonlocal fn, fn1, fn2
     
    1514                fn = fn1 + fn2; fn2 = fn1; fn1 = fn; yield fn
    1615
    17 f1 = Fib()
    18 f2 = Fib()
     16f1 = Fibonacci()
     17f2 = Fibonacci()
    1918for i in range( 10 ):
    2019        print( next( f1 ), next( f2 ) )         # resume
Note: See TracChangeset for help on using the changeset viewer.