Steve Holden a écrit : > A.T.Hofkamp wrote: > (snip) >> So if copying all methods of a native dictionary is not enough, what >> should I >> do to make my class work as a dictionary WITHOUT deriving from dict >> (which will >> obviously work). >> > You have to overwrite the "__new__" method to return an object of your > new type.
??? This applies to subclasses of immutable types, but I don't see the point here. The problem is - as Peter pointed out - that __magic__ methods are not looked up in instances when using new-style classes. -- http://mail.python.org/mailman/listinfo/python-list