A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2016-October/146591.html below:

[Python-Dev] Is explicit registration of Iterators needed?

[Python-Dev] Is explicit registration of Iterators needed? [Python-Dev] Is explicit registration of Iterators needed?Guido van Rossum guido at python.org
Fri Oct 7 10:37:58 EDT 2016
On Fri, Oct 7, 2016 at 6:36 AM, Serhiy Storchaka <storchaka at gmail.com> wrote:
> A number of builtin iterator classes (but not all builtin iterator classes)
> are registered with the Iterator ABC in Lib/_collections_abc.py.  But
> isinstance(it, Iterable) check works without explicit registration, because
> Iterable has __subclasshook__ that checks iterator methods.  Is there a need
> in explicit registrations?  Or their can be safely removed?

The preferred apprach is actually inheritance; registration comes
next; the __subclasshook__ is a final compromise to the tradition of
duck typing. I think the registrations should stay.

-- 
--Guido van Rossum (python.org/~guido)
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4