[Almad]
> I discovered this behaviour in dictionary which I find confusing. In
> SneakyLang, I've tried to extend dictionary so it visits another class
> after something is added:
>
> class RegisterMap(dict):
>     def __setitem__(self, k, v):
>         dict.__setitem__(self, k,v)
>         self[k].visit_register_map(self)
>
>
> However, when constructing dictionary with dictionary in constructor
> like d = RegisterMap({'k':'v'}), __setitem__ is not called,

Try subclassing from UserDict.DictMixin.


Raymond

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to