Set & Frozenset?

Paul Rubin http
Tue Mar 10 15:29:57 EDT 2009


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



More information about the Python-list mailing list