[Python-3000] Change to class construction?
Georg Brandl
g.brandl at gmx.net
Sat Jul 7 08:55:12 CEST 2007
Greg Ewing schrieb:
> Phillip J. Eby wrote:
>> This looks like a bug to me. A list comprehension's local scope
>> should be the locals of the enclosing code, even if its loop indexes
>> aren't exposed to that scope.
>
> It sounds like list comprehensions are being implemented
> using genexps behind the scenes now.
That's not true, but the implementation is somewhat similar in that
the code is executed in its own function context.
> Is this wise? In a recent thread, I suggested that one
> of the reasons for keeping the LC syntax was that it
> could be faster than list(genexp). Has anyone investigated
> whether any speed is being lost by making them equivalent?
I don't remember the details, but IIRC the new LC implementation
was not slower than the 2.x one. Nick should know more about that.
Georg
--
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.
More information about the Python-3000
mailing list