Adam Atlas <[EMAIL PROTECTED]> wrote: > On May 2, 5:24 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > > I think that most people accomplish this by: > > > > class blah: > > __initial_values={'a': 123, 'b': 456} > > > > def __init__(self): > > self.__dict__.update(self.__initialvalues) > > That's not really what I'm talking about... I'm talking about > replacing the __dict__ with a SUBCLASS of dict (not just default > values), and that's at the time of the class declaration (the creation > of `blah` as a `type` instance), not at instance creation.
The metaclass only enters the picture AFTER the class body has run (and built a __dict__). As I explained many times: class ic(bases): <body> means: -- run the <body> to create a dictionary D -- identify the metaclass M -- execute: ic = M("ic", bases, D) the body always creates a dictionary -- you can't override that with metaclasses. Maybe some deep bytecode hacks might work, but I have some doubts in the matter (not given it much thought, tho). Alex -- http://mail.python.org/mailman/listinfo/python-list