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-May/044652.html below:

[Python-Dev] PEP 289 - Generator Expressions

[Python-Dev] PEP 289 - Generator Expressions - Let's Move For ward [Python-Dev] PEP 289 - Generator Expressions - Let's Move For wardJeremy Hylton jeremy at alum.mit.edu
Mon May 3 22:42:53 EDT 2004
On Mon, 2004-05-03 at 09:58, Jewett, Jim J wrote:
> Guido van Rossum:
> 
> > My counter to that is that *any* use of genexps where the consumer
> > doesn't consume (or discard) the iterator before the next line is
> > reached is extremely advanced use.
> 
> This might be worth putting in the PEP and the docs -- 

We are in rather dire need of docs and a revised PEP.

> Normal usage of a generator expression is to immediately consume 
> the entire sequence, or to discard the remainder.  
> 
> If portions of a generator *are* used later, programmers may need 
> some extra precautions to ensure that all names still have the 
> desired bindings.  

There may be a general rule that functions that make use of free
variables are best programmed in a functional style, where the function
doesn't depend on side-effects to those variables.

Jeremy



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