A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-April/044624.html below:

[Python-Dev] Re: PEP 289 - Generator Expressions

[Python-Dev] Re: PEP 289 - Generator Expressions - Let's Move Forward [Python-Dev] Re: PEP 289 - Generator Expressions - Let's Move ForwardRussell E. Owen rowen at cesmail.net
Fri Apr 30 17:00:08 EDT 2004
In article <5.2.1.1.0.20040430142620.030304e8 at pop.bluewin.ch>,
 Samuele Pedroni <pedronis at bluewin.ch> wrote:

>...
> this assumes that people will choose either generator expressions or list 
> comprehesions on a case-by-case basis. I'm not sure it's a reasonable 
> assumption for the whole range of users - starting with newbies. Probably 
> documentation and what is predicated on c.l.p will influence this.

I completely agree. Generator expressions and list comprehensions are 
similar enough that it seems a wart to have to carefully differentiate 
between two in normal use. 

Personally, I'd only like to see generator expressions added to Python 
if they can allow list comprehensions to be deprecated -- to avoid 
language clutter.

One question, though: is "if" part of generator expressions or not? I 
read the current version of the PEP and I'm confused. It offers the 
example:

max(len(line)  for line in file  if line.strip())

But that is the only instance in the PEP that I noticed. The section 
"The Details" says almost nothing about "if". The only thing I found 
that might be relevant appeared at the end of: "2. The syntax 
requires...": "...where listmaker1 is almost the same as listmaker, but 
only allows a single test after 'for' ... 'in'." I suppose that might be 
saying that a single "if" condition is allowed. If so, great!

-- Russell


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