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

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

[Python-Dev] comprehension abbreviation (was: Adding any() and all()) [Python-Dev] comprehension abbreviation (was: Adding any() and all())Eric Nieuwland eric.nieuwland at xs4all.nl
Mon Mar 14 13:42:29 CET 2005
Gareth McCaughan wrote:

> I'd like it, and my reason isn't "just to save typing".
> There are two reasons.
>
>   1 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.
>
>   2 Seeing [x for x in stuff if condition] triggers my internal
>     duplicated-stuff alarm, and it's distracting, in the same sort
>     of way as it's distracting in C or C++ seeing

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.

Remember we're doing set theory stuff here. IMHO we should follow its 
notation conventions as much as we can.

--eric

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