On Thu, Jun 17, 2021 at 5:52 PM Jelle Zijlstra <jelle.zijls...@gmail.com> wrote:
> El jue, 17 jun 2021 a las 14:45, David Mertz (<me...@gnosis.cx>) escribió: > >> On Thu, Jun 17, 2021, 5:24 PM Ben Rudiak-Gould >> >>> Okay, slightly off-topic, but can we *please* allow >>> >>> [*chunk for chunk in list_of_lists] >>> >> > It is completely non-obvious to me what that would even MEAN. I cannot >> derive anything obvious from other uses of *. >> > > My reading is that it would behave like `[*chunk1, *chunk2, *chunk3]` > would behave if `list_of_lists = [chunk1, chunk2, chunk3]`. I would support > adding this behavior to Python. > I guess I can kinda see that analogy. But a loop is an assignment, and this doesn't mean "flatten": a, b, *c = 1, 2, 3, 4, 5, 6 Moreover, in a regular loop: >>> for *x in [a, b, c]: ... print(x) File "<ipython-input-13-a22866454ece>", line 1 for *x in [a, b, c]: ^ SyntaxError: starred assignment target must be in a list or tuple Neither of my examples, I admit, are quite the same as the comprehension. Nonetheless, I definitely don't think the proposed syntax is "the one obvious way to do it." -- The dead increasingly dominate and strangle both the living and the not-yet born. Vampiric capital and undead corporate persons abuse the lives and control the thoughts of homo faber. Ideas, once born, become abortifacients against new conceptions.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/4233PSBBAWEQBPGNN5KVDBGUQZ6FQ7EU/ Code of Conduct: http://python.org/psf/codeofconduct/