Wow, strong language. Not really helping people see it your way. On Thu, Jun 17, 2021 at 14:26 Ben Rudiak-Gould <[email protected]> wrote:
> On Thu, Jun 17, 2021 at 12:37 AM Serhiy Storchaka <[email protected]> > wrote: > >> And it is equivalent to pure Python code >> >> [x for chunk in list_of_lists for x in chunk] >> > > Okay, slightly off-topic, but can we *please* allow > > [*chunk for chunk in list_of_lists] > > some day. I think it was left out because some discussion concluded it > would be too confusing, which is ridiculous. I assumed it would work and > was confused to find that it didn't. It's blatantly inconsistent. > > It's not even the performance I care about, it's the unreadability of > having an extra "for i_have_to_think_of_yet_another_variable_name in > whatever" at the end of the list comprehension (at maximum distance from > where the variable is used). I've wished for this feature ridiculously many > times. > > >> It would be >> possible to make the compiler recognizing such pattern and generating >> more efficient bytecode (LIST_EXTEND instead of an internal loop with >> LIST_APPEND), but I am not sure that this case is common enough to >> complicate the compiler. >> > > In my personal experience it's very common. > > _______________________________________________ > 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/YH7COSZIV5BWQ3EOEA5MQMBHMB3OQNND/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- --Guido (mobile)
_______________________________________________ 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/7C6VIG52AEBKTEE4KD5MIGTHINEFWZEG/ Code of Conduct: http://python.org/psf/codeofconduct/
