[Tutor] How to load a dict into a dict subclass?

Kent Johnson kent37 at tds.net
Tue Oct 27 21:57:25 CET 2009


On Tue, Oct 27, 2009 at 3:02 PM, Albert-Jan Roskam <fomcl at yahoo.com> wrote:
> I thought reimplementing dict was a matter of defining a __dict__ attribute in the Bar class? And isn't the normal dict inherited anyway? (through __super__)
>
> Or, if one would want to disable inheritance of the normal dict, one could use __slots__. Right?
>
> Or did I misinterpret the New Testament of my Python Bible?

You are confusing the __dict__ attribute of most objects with the dict
(dictionary) type. The OP is interested in subclassing the dict type.

Kent


More information about the Tutor mailing list