source: doc/papers/concurrency/examples/Format.py@ f673c13c

ADT arm-eh ast-experimental enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr pthread-emulation qualifiedEnum
Last change on this file since f673c13c was 2e041e27, checked in by Peter A. Buhr <pabuhr@…>, 7 years ago

add examples directory for testing code in the paper

  • Property mode set to 100644
File size: 547 bytes
Line 
1def Format():
2 try:
3 while True:
4 for g in range( 5 ): # groups of 5 blocks
5 for b in range( 4 ): # blocks of 4 characters
6 print( (yield), end='' ) # receive from send
7 print( ' ', end='' ) # block separator
8 print() # group separator
9 except GeneratorExit: # destructor
10 if g != 0 | b != 0: # special case
11 print()
12
13fmt = Format()
14next( fmt ) # prime generator
15for i in range( 41 ):
16 fmt.send( 'a' ); # send to yield
17
18# Local Variables: #
19# tab-width: 4 #
20# compile-command: "python3.5 Format.py" #
21# End: #
Note: See TracBrowser for help on using the repository browser.