[Python-3000] [Python-Dev] Python 3000 Status Update (Long!)
Greg Ewing
greg.ewing at canterbury.ac.nz
Fri Jun 29 01:26:13 CEST 2007
Nick Coghlan wrote:
> There is no function call per loop even when using a
> generator expression - a generator function is implicit defined, and
> then called once to instantiate the generator.
You're right -- I must have been half-thinking of
map() at the time. Resuming the generator ought to
be faster than a function call. But still a bit
slower than in-line code, perhaps.
> I believe the point of adding set
> literal and comprehension syntax is to make it possible to easily speed
> up membership tests for items in known groups
Yes, but set(generator) would do that just as well
as {generator} if it weren't any slower.
So the reasons for keeping the comprehension notations
are (a) slightly more convenient syntax and (b) maybe
a bit faster.
--
Greg
More information about the Python-3000
mailing list