Module Expr Str ImportFrom alias Import alias FunctionDef arguments args NameParam defaults body Return BinOpMult NameLoad Num decorator_list FunctionDef arguments args defaults body Assign NameStore Num Assign NameStore Call NameLoad NameLoad Assign NameStore BinOpMult ListLoad NameLoad NameLoad Assign NameStore Call AttributeLoad NameLoad attr NameLoad FunctionDef arguments args NameParam NameParam defaults body Assign SubscriptStore NameLoad Index NameLoad Call NameLoad NameLoad Expr Call AttributeLoad NameLoad attr decorator_list For TupleStore NameStore NameStore Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr NameLoad NameLoad NameLoad For NameStore Call NameLoad NameLoad body Expr Call AttributeLoad NameLoad attr Expr Call NameLoad BinOpMod Str NameLoad decorator_list If CompareEq NameLoad Str body Expr Call NameLoad
N/A N/A 
This file demonstrates a parallel for loop using goless.
The "parallel for" pattern is very simple,
so I chose a simple example (negating an integer),
rather than something more realistic which would obfuscate things.
Of course this is Python so it's not actually parallel
but you already knew that :)

The example uses shared memory and a 'semaphor' channel.
Shared memory is normally a no-no,
but is useful here so we don't need the overhead of using
extra channels.

See http://www.golangpatterns.info/concurrency/parallel-for-loop
for more information.
 __future__ print_function N/A goless dosomething N/A N/A x N/A N/A N/A N/A x -1 N/A pfor N/A N/A N/A N/A N/A n 10 N/A items N/A range n N/A results N/A N/A None n N/A semaphore N/A N/A goless chan n mapper N/A N/A index value N/A N/A N/A N/A results N/A index N/A dosomething value N/A N/A N/A semaphore send N/A N/A N/A i item N/A enumerate items N/A N/A N/A N/A goless go mapper i item N/A _ N/A range n N/A N/A N/A N/A semaphore recv N/A N/A print N/A Finished: %s results N/A N/A N/A __name__ __main__ N/A N/A N/A pfor