On Sep 25, 7:07 pm, Zentrader <[EMAIL PROTECTED]> wrote:
> Note that in list comprehension, [x for x in (1, 2, 3)], the
> for loop allocates memory the same way, but the scope changes so that
> "x" is visible outside the for loop,

How is this different? The variable spilling of list comprehension is
the same as for regular for loops. The (#) and (##) lines below don't
print the same value of j.

>>> for j in range(3):
...   print j, "first loop" (#)
...   for j in range(3):
...     print "     ", j, "2nd loop"
...   print j, "first loop, again?"  (##)


- Willem

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

Reply via email to