Boris Borcic wrote:
One way :>>> from functools import partial >>> def func(item) : print item >>> llist = [partial(func,item) for item in range(5)] >>> for thing in llist : thing() 0 1 2 3 4
Another way:
class Func(object):
def __init__(self, item):
self.item = item
def __call__(self):
print self.item
llist = [Func(item) for item in range(5)]
for thing in llist: thing()
--
http://mail.python.org/mailman/listinfo/python-list
