On Thu, May 7, 2020 at 9:48 AM Kirill Balunov <kirillbalu...@gmail.com> wrote:
> Sorry for off topic. Isn't this chain.from_iterable just a historical > legacy... now we have PEP 448 and I see no differences* between > chain(*iterable) vs chain.from_iterable(iterable). Are there? > > * chain.from_iterable is a little bit faster for small iterables, but if > at that time we had PEP 448, would this small speed benefits be enough to > make additional method to chain. I think no. > > -gdg > >> <http://python.org/psf/codeofconduct/> > > `chain(*iterable)` converts iterable into a tuple, concretizing it in memory. chain.from_iterable(iterable) is lazy and goes through the elements one a time, meaning iterable can be infinite. I don't think PEP 448 has any bearing on that.
_______________________________________________ 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/KPNW3MRWKNJ3PYR55YWHCPP5J6J5V3L6/ Code of Conduct: http://python.org/psf/codeofconduct/