On 02/09/2015 05:48 PM, Donald Stufft wrote: > > 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 with Donald. I would expect a list of lists from that syntax... or maybe a list of tuples? -- ~Ethan~
signature.asc
Description: OpenPGP digital signature
_______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com