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
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com