instantiate a class with a variable

John johnwadeunderwood at yahoo.com
Tue Mar 28 01:32:41 CEST 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