Multi-isinstance idiom (Re: Deprecate tabs for indenting (was Re: Indenting with tabs vs spaces))

Tim Peters tim.one at home.com
Fri Dec 7 21:47:12 CET 2001


[Mike C. Fletcher]
> ...
> AFAIK, list comprehensions are basically just syntactic sugar around
> regular loops, so they aren't likely any faster than a for loop.  If
> that's changed, it would be good to know.

They are just sugar, but are nevertheless faster than the for loop most sane
<wink> people are *likely* to write (the generated code uses a bound method
object for the hidden list.append, doing the method lookup just once before
the loop begins).





More information about the Python-list mailing list