Changeset 04e6f93 for doc/papers/concurrency/examples/Format.py
- Timestamp:
- Feb 27, 2020, 4:04:25 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- a037f85
- Parents:
- 41efd33 (diff), 930b504 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/papers/concurrency/examples/Format.py
r41efd33 r04e6f93 4 4 for g in range( 5 ): # groups of 5 blocks 5 5 for b in range( 4 ): # blocks of 4 characters 6 print( (yield), end='' ) # receive from send 6 while True: 7 ch = (yield) # receive from send 8 if '\n' not in ch: 9 break 10 print( ch, end='' ) # receive from send 7 11 print( ' ', end='' ) # block separator 8 12 print() # group separator … … 11 15 print() 12 16 17 input = "abcdefghijklmnop\nqrstuvwx\nyzxxxxxxxxxxxxxx\n" 18 13 19 fmt = Format() 14 20 next( fmt ) # prime generator 15 for i in range( 41 ):16 fmt.send( 'a'); # send to yield21 for i in input: 22 fmt.send( i ); # send to yield 17 23 18 24 # Local Variables: # 19 25 # tab-width: 4 # 20 # compile-command: "python3. 5Format.py" #26 # compile-command: "python3.7 Format.py" # 21 27 # End: #
Note: See TracChangeset
for help on using the changeset viewer.