UserDict -> dict, reasons for migrating existing code

Steven Taschuk staschuk at
Tue Jul 22 03:10:58 CEST 2003

Quoth Andreas Kuntzagk:
> what would be the reasons to migrate existing code from the use of
> UserDict() to dict()? (UserString ...) What would be reasons against?
> Reasons I can think of:
> pro:
> - Speed Improvement because of a level of indirection less
> - UserDict can become deprecated
> con:
> - Code not working whith older python
> - cost of migrating large codebase
> Do you know other reasons?

I think there are still some issues with subclassing the built-in
types, but I've no idea what they are.  (Hopefully somebody more
knowledgeable will comment.)

Your thought that a dict subclass might be faster than a UserDict
subclass is plausible, but I'd strongly suggest doing some timing
experiments before doing any large migration under that assumption.

Otherwise, I think you've said everything.

Steven Taschuk             "The world will end if you get this wrong."
staschuk at     -- "Typesetting Mathematics -- User's Guide",
                                 Brian Kernighan and Lorrinda Cherry

More information about the Python-list mailing list