
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
On Thu, May 7, 2020 at 3:24 AM David Mertz mertz@gnosis.cx wrote:
The only precedent that jumps out for me is itertools.chain() and itertools.chain.from_iterable(). It's quite likely that something I don't use much has used the same pattern though.
On Wed, May 6, 2020, 8:17 PM Christopher Barker pythonchb@gmail.com wrote:
On Wed, May 6, 2020 at 10:31 AM Alex Hall alex.mojaki@gmail.com wrote: zip.shortest(...) # same as zip(...) zip.longest(...) zip.checksame(...)
I presume that zip() would keep its current behavior, yes?
I kind of like this -- is there any precedent for it in the standard library?
The PEP seems to reject this saying:
The actual zip type is an undocumented implementation detail. Adding
additional methods or constructors is really a much larger change that is not necessary to achieve the stated goal.
well, yes and no -- the first part indicates that we could totally change the type of the zip, as long as it's a collable that returns an iterator.
Whether adding additional methods is too large a change -- that's totally a matter of opinion.
Having these alternative 'methods' would be similar to having different
functions in itertools, indeed -- same idea, different namepace.
-CHB
-- Christopher Barker, PhD
Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython
Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/5EC4BL... Code of Conduct: http://python.org/psf/codeofconduct/
Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/3BOXVZ... Code of Conduct: http://python.org/psf/codeofconduct/