On 2016-10-17 16:35, Steven D'Aprano wrote:
>and many times I have been irritated by the fact that the
>one-item-per-loop invariant exists.  I'm not sure whether I'm in favor of
>this particular syntax, but I'd like to be able to do the kind of things it
>allows.  But doing them inherently requires breaking the invariant you
>describe.
That last point is incorrect. You already can do the kind of things this
thread is about:

     [*t for t in iterable]  # proposed syntax: flatten

can be written as:

     [x for t in iterable for x in t]

Right, but by "doing those kinds of things" I mean doing them more in a more conise way without an extra level of iteration. (You can "do multiplication" by adding repeatedly, but it's still nice to have multiplication as an operation.)

--
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no path, and leave a trail."
   --author unknown
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to