Deriving from builtin types with limited instances and Extending FAQ 6.6

Gerrit Holl gerrit at
Sun Feb 9 11:46:08 CET 2003

Gerrit Holl schreef op zondag  9 februari om 09:48:41 +0000:
> Laura Creighton schreef op zondag  9 februari om 03:20:32 +0000:
> > <snip Gerrit playing with deriving from classes>
> > 
> > Can you write up a better FAQ entry based on your experiences?
> I can describe the behaviour, but I can't describe why it behaves as such.

Yes I can, because I found the answer:
You can use multiple inheritance, but you can't multiply inherit from
different built-in types (for example, you can't create a type that
inherits from both the built-in dict and list types). This is a
permanent restriction; it would require too many changes to Python's
object implementation to lift it. However, you can create mix-in
classes by inheriting from "object". This is a new built-in, naming
the featureless base type of all built-in types under the new system

I think I will try to write up a better FAQ entry answer.


Asperger Syndroom - een persoonlijke benadering:
Het zijn tijden om je zelf met politiek te bemoeien:

More information about the Python-list mailing list