instantiate a class with a variable

John johnwadeunderwood at yahoo.com
Mon Mar 27 18:32:41 EST 2006


Hi, is it possible to instantiate a class with a variable.

example

class foo:
    def method(self):
        pass

x='foo'

Can I use variable x value to create an instance of my class?

Thanks, John




More information about the Python-list mailing list