[Python-3000] UserDict revamp

Guido van Rossum guido at python.org
Thu Feb 15 05:51:13 CET 2007


I tried to fix a few more unit tests tonight that had started failing
after the introduction of dict views. Looking over UserDict.py, it's
clear that this module needs more work -- while I banged it into
submission with minimal effort, it would reallly make a lot more sense
to redesign UserDict and MixinDict so they are more like dict, even if
this means that their users will have to be fixed, too.

Perhaps the most egregious example is MixinDict, which currently
assumes that keys() is a primitive operation returning a list, and
builds __iter__() out of that. Obviously a better approach is to turn
this around. (I'd have thought that ever since 2.2 this would have
been the better design, but perhaps it was too late then already.)

Is someone interested in looking at a redesign and cleanup of these
classes? I suppose that they also need a Python implementation of
dictionary views -- some of this can be lifted straight out of PEP
3106, fortunately.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list