[Python-Dev] ABC issues (original) (raw)
Guido van Rossum guido at python.org
Tue May 27 19:33:26 CEST 2008
- Previous message: [Python-Dev] ABC issues
- Next message: [Python-Dev] ABC issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, May 26, 2008 at 4:11 PM, Raymond Hettinger <python at rcn.com> wrote:
Deque's do not support count(), insert() or iadd(). They should not be registered. If it doesn't implement the MutableSequence protocol it still is a Sized container. However currently it's not registered as a container. Seems useless to me. I don't think the intent of the ABC pep was to mandate that every class that defines len must be registered as Sized.
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.
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.
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- Previous message: [Python-Dev] ABC issues
- Next message: [Python-Dev] ABC issues
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]