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/2003-October/039226.html below:

[Python-Dev] accumulator display syntax

[Python-Dev] accumulator display syntax [Python-Dev] accumulator display syntaxNeil Schemenauer nas-python at python.ca
Tue Oct 21 19:39:10 EDT 2003
Guido:
> Personally, I still like the idea best to make
> 
>     (x for x in S)
> 
> be an iterator comprehension
> 
> and
> 
>     [x for x in S]
> 
> syntactic sugar for the common operation
> 
>     list((x for x in S))

FWIW, that's enough to switch my vote for generator expressions from
-0 to +0.  If they work this way then there is essentially no extra
complexity in the language.  It's important to look at things from
the perspective of a new Python programmer, I think.

Another nice thing is that we have tuple and dict comprehensions
for free:

  tuple(x for x in S)
  dict((k, v) for k, v in S)
  Set(x for x in S)

Aside from the bit of syntactic sugar, everything is nice an
regular.

  Neil

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