Python 2.2b1 dicts, iteration, and subclassing

Alexis Layton alexis.layton at
Fri Nov 30 19:46:12 CET 2001

Note: Python 2.2b2 is not yet available for the Macintosh platform so 
this may have been
fixed/changed already.

I created a new-style subclass of "dictionary" ("dict" in 2.2b2) in 
which the order
of insertion of keys is remembered, the SequencedDict. I redefined the 
keys, values,
and items methods, as well as the iterkeys, itervalues, iteritems, and 
__iter__ methods.
Everything works as expected, except that it seems repr (which I did not 
is using the built-in dictionary iteration or doing its own.

The question for all you Pythonistas out there is, should it?  To what 
extent should
the built-in behavior  of objects like dictionaries be affected by 

Alexis Layton
alexis.layton at

More information about the Python-list mailing list