Subclassing Python's dict

Sergey Simonenko gforgx at lavabit.com
Wed Aug 5 21:51:52 EDT 2009


Hi,

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: http://www.opera.com/mail/




More information about the Python-list mailing list