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/2005-March/052210.html below:

[Python-Dev] Re: comprehension abbreviation (was: Adding any() and all())

[Python-Dev] Re: comprehension abbreviation (was: Adding any() and all()) [Python-Dev] Re: comprehension abbreviation (was: Adding any() and all())Jim Jewett jimjjewett at gmail.com
Wed Mar 16 02:54:07 CET 2005
Gareth McCaughan wrote:
> Some bit of my brain is convinced that [x in stuff if condition]
> is the Right Syntax and keeps making me type it even though
> I know it doesn't work.

(and I agree with Gareth)


On Monday 2005-03-14 12:42, Eric Nieuwland wrote:
> The full syntax is:
> [ f(x) for x in seq if pred(x) ]
> being allowed to write 'x' instead of 'identity(x)' is already a 
> shortcut, just as dropping the conditional part.

I think this is the heart of the disagreement.

Mentally, I'm not collecting some function of x (which happens
to be identity).  I am filtering an existing set.  Being able to
collect f(x) instead is just a useful but hackish shortcut.

Gareth again:
> and in fact no set theorist would be at all troubled by seeing

>    { x in S : predicate(x) }

> which is the nearest equivalent in mathematical notation
> for the abbreviated comprehension expressions being discussed.

Again, I agree.  I think that is what I am unconsciously writing,
by translating the ":" into "if"

-jJ
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