On Thu, May 7, 2020 at 1:26 AM Christopher Barker <python...@gmail.com> wrote:
> > But wait a minute, zip isn't just a "callable", it's a class, and adding > more methods to it seems perfectly natural, just like lots of other > built-in classes. > >> >> Zip is a class in CPython 3.8. it may or may not be in other >> implementations or versions. The API users are currently promised says >> nothing about it needing to be implemented as a class. >> > > and it was a function in 2.7. > a zip instance on the other hand, returns an iterable, that does not > provide any other methods or uses. I have to say, I have not idea why zip > is a class rather than a function that returns a zip_iterator instance, but > it is certainly an implementation detail. > It seems common in all the utility "functions" that make iterators. I haven't tried everything, but for example: >>> type(map), type(filter), type(itertools.count), type(itertools.product) (<class 'type'>, <class 'type'>, <class 'type'>, <class 'type'>) But I didn't know those until I looked... and I don't HAVE TO know for any practical use of them. As Chris notes, it's an implementation detail, subject to change. -- The dead increasingly dominate and strangle both the living and the not-yet born. Vampiric capital and undead corporate persons abuse the lives and control the thoughts of homo faber. Ideas, once born, become abortifacients against new conceptions.
_______________________________________________ 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/G6GJMINUL5N4RVAW5EI4MSXC5NRKC2X2/ Code of Conduct: http://python.org/psf/codeofconduct/