Dan Bishop wrote:

x = 17
sum(x for x in xrange(101))

5050

x

17


Your example with generator expressions is interesting. Even more interesting is:

def foo(x):
     y= (i for i in x)
     return y

From the disassembly it seems that the generator is a code object but
'x' is not a cell variable. WTF?  How do I disassemble the generator?
Must look into this....

[ list comprehensions are different because they expand to inlined bytecode ]

jf

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to