R. David Murray added the comment:

Note also that your first example worked only because your loop variable was 
named i.  If you used, say, 'j', you'd get the same result as in your second 
example.  This is because the closure is over the named variable, and both in 
your definition loop and your print loop, that variable is the 'i' in the 
global namespace.

nosy: +r.david.murray

Python tracker <rep...@bugs.python.org>
Python-bugs-list mailing list

Reply via email to