Ignore:
File:
1 edited

Legend:

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

    ra573c22 r2e041e27  
    44                        for g in range( 5 ):    # groups of 5 blocks
    55                                for b in range( 4 ): # blocks of 4 characters
    6                                         while True:
    7                                                 ch = (yield) # receive from send
    8                                                 if '\n' not in ch:
    9                                                         break
    10                                         print( ch, end='' ) # receive from send
     6                                        print( (yield), end='' ) # receive from send
    117                                print( '  ', end='' ) # block separator
    128                        print()                                 # group separator
     
    1511                        print()
    1612
    17 input = "abcdefghijklmnop\nqrstuvwx\nyzxxxxxxxxxxxxxx\n"
    18 
    1913fmt = Format()
    2014next( fmt )                                                     # prime generator
    21 for i in input:
    22         fmt.send( i );                          # send to yield
     15for i in range( 41 ):
     16        fmt.send( 'a' );                                # send to yield
    2317
    2418# Local Variables: #
    2519# tab-width: 4 #
    26 # compile-command: "python3.7 Format.py" #
     20# compile-command: "python3.5 Format.py" #
    2721# End: #
Note: See TracChangeset for help on using the changeset viewer.