[Python-Dev] (no subject)

Paul Moore p.f.moore at gmail.com
Tue Feb 10 10:39:23 CET 2015


On 10 February 2015 at 01:48, Donald Stufft <donald at stufft.io> wrote:
> I am really really -1 on the comprehension syntax.

[... omitting because gmail seems to have messed up the quoting ...]

> I don’t think * means “loop” anywhere else in Python and I would never
> “guess” that [*item for item in iterable] meant that. It’s completely non
> intuitive. Anywhere else you see *foo it’s unpacking a tuple not making an
> inner loop. That means that anywhere else in Python *item is the same thing
> as item[0], item[1], item[2], …, but this PEP makes it so just inside of a
> comprehension it actually means “make a second, inner loop” instead of what
> I think anyone who has learned that syntax would expect, which is it should
> be equivalent to [(item[0], item[1], item[2], …) for item in iterable].

I agree completely with Donald here. The comprehension syntax has
consistently been the part of the proposal that has resulted in
confused questions from reviewers, and I don't think it's at all
intuitive.

Is it allowable to vote on parts of the PEP separately? If not, then
the comprehension syntax is enough for me to reject the whole
proposal. If we can look at parts in isolation, I'm OK with saying -1
to the comprehension syntax and then we can look at whether the other
parts of the PEP add enough to be worth it (the comprehension side is
enough of a distraction that I haven't really considered the other
bits yet).

Paul


More information about the Python-Dev mailing list