Subclassing Python's dict

Sergey Simonenko gforgx at
Thu Aug 6 03:51:52 CEST 2009


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

The whole issue is that I should redefine 'setdefault' and 'update'  
methods after redefining '__setitem__' or/and '__delitem__',
otherwise 'update' and 'setdefault' ignore redefined '__setitem__' and use  
builtin dict's one so dict looks kinda like a black box.

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

Kind regards, Sergey.

Написано в почтовом клиенте браузера Opera:

More information about the Python-list mailing list