Still an import for that version! On Thu, Jun 17, 2021, 2:07 AM Guido van Rossum <[email protected]> wrote:
> Just trolling along, flattening a list could be written as > > functools.reduce(list.__iadd__, xs, []) > > Right? > > On Wed, Jun 16, 2021 at 22:53 David Mertz <[email protected]> wrote: > >> On Thu, Jun 17, 2021, 1:38 AM Chris Angelico >> >>> >>> list(chain.from_iterable(list_of_lists)) >>> >>> > More-itertools has flatten(): >>> https://more-itertools.readthedocs.io/en/stable/api.html#more_itertools.flatten. >>> That seems better than a method specific to lists. >>> >>> ... which is built on top of chain.from_iterable. :) >>> >> >> Oh, of course. And anyone can put it in their personal utility library >> too. I just meant it in the sense that the name might be more intuitive to >> beginners. >> >>> _______________________________________________ >> 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/2T53ADB3TVQJF2UENEXKB5G5ZWTQOQVW/ >> 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/2FMF5WXNHPBTGHGUZEWLZTZC4VJS232U/ Code of Conduct: http://python.org/psf/codeofconduct/
