Work around metaclass programming

Zac Burns zac256 at gmail.com
Mon Oct 12 17:21:59 EDT 2009


I have a class called Signal which is a descriptor. It is a descriptor
so that it can create BoundSignals, much like the way methods work.
What I would like to do is to have the class be a descriptor when
instantiated in what will be the locals of the class, but not a
descriptor everywhere else.

Can I do this without requiring the class to use a special metaclass
that does the transformation?

One way I can think of which would work if there is such a thing would
be a hook that type will call on the value of locals if that value is
defined. That way I could just return the descriptor from that hook.
The advantage of this over using a metaclass is that these are
combinable.

Am I making sense?

--
Zachary Burns
(407)590-4814
Aim - Zac256FL
Production Engineer (Digital Overlord)
Zindagi Games



More information about the Python-list mailing list