Hi

I'd like to use metaclasses to dynamically generate a class based on a
parameter to the objects init function.

For example:

class MetaThing(type):
    def __init__(cls, name, bases, dict, extra_information):
        super(MetaThing, cls).__init__(name, bases, dict)
        #setup the class based on the parameter extra_information

class Thing:
    __metaclass__ = MetaThing
    def __init__(self, extra_information):
         #Somehow pass extra_information to the MetaThing

extra_information = 1
t = Thing(extra_information)

The above sample won't work but I hope it demonstrates what I'm trying
to do.

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to