Set & Frozenset?

Paul Rubin http
Tue Mar 10 20:29:57 CET 2009

Terry Reedy <tjreedy at> 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.

More information about the Python-list mailing list