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/038856.html below:

[Python-Dev] accumulator display syntax

[Python-Dev] accumulator display syntaxPhillip J. Eby pje at telecommunity.com
Fri Oct 17 11:54:49 EDT 2003
At 07:41 AM 10/17/03 -0700, Guido van Rossum wrote:
>I'd just like to pipe into this discussion saying that while Peter
>Norvig's pre-PEP is neat, I'd reject it if it were a PEP; the main
>reason that the proposed notation doesn't return a list.  I agree that
>having generator comprehensions would be a more general solution.  I
>don't have a proposal for generator comprehension syntax though, and
>[yield ...] has the same problem.

(yield x*2 for x in foo)

or maybe:

(yield: x*2 for x in foo)

would "yield" better visibility that this is a value that *does* something 
(like lambda).  Or perhaps without the parentheses, but I think they're 
better for clarity, and I'd add them in practice even if they weren't required.

The main problem with a gencomp syntax is that some people are going to use 
it for everything whether they need it or not, even when they have a small 
list and the frame overhead for the generator is going to make it 
slower.  So it almost wants to be a really awkward ugly thing in order to 
discourage them...  but then again, that way lies Ruby.  :)


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