Question about accessing class-attributes.

Thomas Heller theller at python.net
Fri Apr 25 09:14:09 EDT 2003


Michael Hudson <mwh at python.net> writes:

> mis6 at pitt.edu (Michele Simionato) writes:
> 
> > The meta-type conflict is rather annoying, indeed. According to the
> > metaclass book, the language should generate the correct metaclass
> > that solves the conflict automatically, without burden for the
> > programmer. Python is not that magic (yet) therefore you have to
> > solve the conflict yourself.
> 
> I guess a potential problem is that if you do
> 
> class C(object):
>     __metaclass__ = A
> 
> class D(object):
>     __metaclass__ = B
> 
> class E(C, D):
>     pass
> 
> class F(C, D):
>     pass
> 
> you'd like both E and F to have the *same* (rather than merely
> equivalent) metaclasses.  This would seem to be tricky to arrange.

Wouldn't a caching class factory be able to do this?

Thomas




More information about the Python-list mailing list