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/052448.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())Josiah Carlson jcarlson at uci.edu
Tue Mar 29 19:21:12 CEST 2005
Steve Holden <steve at holdenweb.com> wrote:
[...]
> Having to write
> 
>      [x for x in seq]
> 
> to produce a copy of a list doesn't seem that outrageous to me, and I 
> don't find the predicate-less case of your proposal that convincing:
> 
>      [x in seq]
> 
> seems somehow too terse.

And is already valid Python syntax; producing a list of a boolean (if x
is bound), a TypeError (if seq is a dictionary, x is bound, and x isn't
hashable), or a NameError (if x is not bound).

If I recall, changing the meaning of valid Python syntax is to be
frowned upon, and the suggestion should be tossed out the window
strictly because of that reason.  As for "for x" or its equivalent,
being too much additional overhead to type in list comprehensions, I
think maybe we are getting too picky for our own good.

 - Josiah

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