A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-January/041956.html below:

[Python-Dev] [872326] generator expression implementation

[Python-Dev] [872326] generator expression implementation [Python-Dev] [872326] generator expression implementationGuido van Rossum guido at python.org
Mon Jan 12 12:31:14 EST 2004
> Sorry to bring this out again, I didn't find a reference about the following 
> issue in generator expressions:
> 
>   (for x in expr)
> 
> When should 'expr' be evaluated?  A priori, one would expect it to be 
> evaluated immediately, but it is not what the suggested implementation does:
> 
> def __gen():
>   for x in expr:
>     yield x
> __gen()
> 
> This only computes expr when the first element of the generator is needed (so
> it may even never be computed).  Is it done purposefully?  It may also be
> surprising to see the anonymous generator in tracebacks if an exception is
> raised within expr.

Looks like a bug to me; I'd like to hear arguments to the contrary.

--Guido van Rossum (home page: http://www.python.org/~guido/)

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4