A replacement to closures in python?
noama at answers.com
Fri Jan 30 19:36:32 CET 2009
I want to create an array of functions, each doing the same thing with a
change to the parameters it uses... something like:
for name in arr:
print 'hello, my name is '+name
for f in funcs:
And I would like that to print
hello, my name is john
hello, my name is terry
hello, my name is graham
Now I understand why the above code doesn't work as I want it to, but is
there some simple workaround for it?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list