Terry Reedy <tjre...@udel.edu> writes: > > I'd never expect that for-loop assignment is even faster than a > > precreated iter object (the second test)... but I don't think this > > for-looping variable leaking behavior is guaranteed, isn't it? > > It is an intentional, documented feature: ...
I prefer thinking of it as a documented bug. It is fixed in 3.x. I usually avoid the [... for x in xiter] listcomp syntax in favor of list(... for x in xiter) just as an effort to be a bit less bug-prone. -- http://mail.python.org/mailman/listinfo/python-list