Peter Otten wrote:
> You determine the factory Python uses to
> make a class by adding
>
> __metaclass__ = factory
>
> to the class body, so you'll probably end with something like
>
> class ProducerHandlerType(type):
> # your code
>
> class A:
> __metaclass__ = ProducerHandlerType
>
> Without looking into the details -- the (subclass of) type is meant to be
> the class of the class, or the other way round, your normal classes are
> instances of (a subclass of) type. You determine the factory Python uses to
> make a class by adding
>
> __metaclass__ = factory
>
> to the class
Laszlo Nagy wrote:
> I would like to create a hierarchy classes, where the leaves have a
> special attribute called "producer_id". In addition, I would like to
> have a function that can give me back the class assigned to any
> producer_id value. I tried to implement this with a metaclass, but I
>
Hello,
I would like to create a hierarchy classes, where the leaves have a
special attribute called "producer_id". In addition, I would like to
have a function that can give me back the class assigned to any
producer_id value. I tried to implement this with a metaclass, but I
failed. Pleas