[Python-Dev] Re: accumulator display syntax

Guido van Rossum guido at python.org
Sat Oct 18 12:27:50 EDT 2003


> The saddest thing about the ternary operator saga (and it may be the
> fate of this as well) was that the people who wanted the *semantics*
> destroyed their own case by arguing over *syntax*.

I don't see it that way.  There were simply too many people who didn't
want it in *any* form (and even if they weren't a strict majority,
there were certainly too many to ignore).

> I suspect that the only way out of this would be for someone to have
> just implemented it, with whatever syntax they preferred. Then it
> either goes in or not, with Guido's final veto applying, as always.

It was implemented (several times).  That wasn't the point at all.

> Possibly the same is the case here. Unless someone implements iterator
> comprehensions, with whatever syntax they feel happiest with,
> arguments about syntax are sterile, and merely serve to fragment the
> discussion, obscuring the more fundamental question of whether the
> semantics is wanted or not.

Not true.  There are only two major syntax variations contending (with
or without yield) and some quibble about parentheses, and everybody
here seems to agree that either version could work.  The real issue is
whether it adds enough to make it worthwhile to change the language
(again).

My current opinion is that it isn't: for small datasets, the extra
cost of materializing the list using a list comprehension is
negligeable, so there's no need for a new feature, and if you need to
support truly large datasets, you can afford the three extra lines of
code it takes to make a custom iterator or generator.

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list