[Python-Dev] ABC issues

Raymond Hettinger python at rcn.com
Mon May 26 20:59:30 CEST 2008


> * The 2.6-backported Mapping ABC has the 3.0 dict API,
>   that is, it uses keys() that returns a view etc.

Curious to hear what Guido thinks about this one.
A nice use of the Mapping ABC is to be able to
get 3.0 behaviors.  I thought that was the whole
point of all these backports.  If the ABC gets altered,
then it just makes the 2-to-3 conversion harder.


> * The 2.6 UserDict is not registered as a mapping.

Since the API's are not currently the same, it makes
sense that UserDict is not registered. 

If the Mapping ABC does get changed, only IterableUserDict
should get registered.  A regular UserDict does not comply.


> * collections.deque isn't registered as a MutableSequence.

Deque's do not support count(), insert() or __iadd__().
They should not be registered.  General purpose indexing
into a deque is typically a mis-use of the data structure.
It was provided only to make it easier to substitute for lists
in apps the operate only one ends (i.e.d[0], d[1], d[-1], d[-2]
but not d[i] to somewhere in the middle).


> If there are no objections, I will correct these issues
> in the 2.6 and 3.0 branches.

I think none of these changes should be made.


Raymond


More information about the Python-Dev mailing list