Charles D Hixson wrote: > 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 don't understand, Python already does it at runtime: class A: A_class_var = 1 class B(A): B_class_var = 2 def __init__(self): self.B_inst_var = 3 >>> b.A_class_var 1 >>> b.B_class_var 2 >>> b.B_inst_var 3 >>> A.another = 4 >>> b.another 4 Can you post a ">>>"-script of what you would like your classes to do? Toby -- http://mail.python.org/mailman/listinfo/python-list