
7 May
2020
7 May
'20
9:55 a.m.
On Thu, May 7, 2020 at 9:48 AM Kirill Balunov kirillbalunov@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
`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.