Hi, Guido van Rossum <guido <at> python.org> writes:
> There's no need to register as Sized -- the Sized ABC recognizes > classes that define __len__ automatically. The Container class does > the same looking for __contains__. Since the deque class doesn't > implement __contains__, it is not considered a Container -- correctly > IMO. True. deque doesn't implement __contains__. However "in" still works because of the __iter__ fallback. So from the API's perspective it's still compatible, even though it doesn't implement it. The same probably affects old style iterators (__getitem__ with index). One could argue that they are still iterable or containers, but that's harder to check so probably not worth the effort. > >> Another issue is that builtin types don't accept ABCs currently. For > >> example > >> set() | SomeSet() gives a TypeError, SomeSet() | set() however works. > > > > Pandora's Box -- sure you want to open it? > > In 3.0 I'd like to; this was my original intent. In 2.6 I think it's > not worth the complexity, though I won't complain. I would love to help on that as I'm very interested in that feature. Regards, Armin _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com