El jue, 17 jun 2021 a las 15:26, Steven D'Aprano (<[email protected]>) escribió:
> On Thu, Jun 17, 2021 at 02:51:44PM -0700, Jelle Zijlstra wrote: > > El jue, 17 jun 2021 a las 14:45, David Mertz (<[email protected]>) > 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] > > > 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. > > Oh, that's clever, and I might even have thought of that myself if it > wasn't described as "off-topic" *wry smile* > > So in a generator comprehension, what would it do? > > (*chunk for chunk in values) > # equivalent to... ? > # (item for chunk in values for item in chunk) perhaps? > > I guess we could allow an equivalent in dict comprehensions: > > {**chunk for chunk in values} > > for unpacking nested dicts or (key,value) pairs. > > To me those all feel like the obvious interpretations. And I'm Dutch, so by the Zen of Python that means it's the right interpretation :) > Clever... or maybe *too* clever? > > -- > Steve > _______________________________________________ > Python-ideas mailing list -- [email protected] > To unsubscribe send an email to [email protected] > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/[email protected]/message/RL54S6ZAPHBNC5CDYUOJRSWEGSLCBOKS/ > Code of Conduct: http://python.org/psf/codeofconduct/ >
_______________________________________________ Python-ideas mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/[email protected]/message/RYTCIEI6P7XTBUJXRGCBVD6JNRU6XP7P/ Code of Conduct: http://python.org/psf/codeofconduct/
