source: doc/papers/concurrency/examples/Format.py @ 50aeb6f

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since 50aeb6f was 2e041e27, checked in by Peter A. Buhr <pabuhr@…>, 5 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.