Subclassing Python's dict

Xavier Ho contact at xavierho.com
Wed Aug 5 16:32:15 CEST 2009


On Thu, Aug 6, 2009 at 11:51 AM, Sergey Simonenko <gforgx at lavabit.com>wrote:

> I subclass builtin 'dict' in my application and experience some problems
> with it.
>

You should subclass collections.UserDict, and not the default dict class.
Refer to the collections module.

Also, the ABC MutableMapping might be of your interest.


> Another guy have reported me that he experiences similar problems with
> subclassing builtin 'list'.


Similarly, UserList is what you should subclass.

HTH,

Ching-Yun "Xavier" Ho, Technical Artist

Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: contact at xavierho.com
Website: http://xavierho.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090806/109577af/attachment.html>


More information about the Python-list mailing list