How to build Hierarchies of dict's? (Prototypes in Python?)

Charles D Hixson charleshixsn at earthlink.net
Fri Feb 23 15:53:59 EST 2007


I'm sure I've read before about how to construct prototypes in Python, 
but I haven't been able to track it down (or figure it out).

What I basically want is a kind of class that has both class and 
instance level dict variables, such that descendant classes 
automatically create their own class and instance level dict variables.  
The idea is that if a member of this hierarchy looks up something in 
it's local dict, and doesn't find it, it then looks in the class dict, 
and if not there it looks in its ancestral dict's.  This is rather like 
what Python does at compile time, but I want to do it at run time.

I'm sure I've seen how to do it...but have no idea where, or what it was 
called, or when (probably around the time Prothon was being discussed, 
as I have the idea of prototype associated with it for no clear reason).



More information about the Python-list mailing list