On Saturday, February 13, 2016 at 11:39:56 PM UTC-6, Veek. M wrote:
> Nope - this is what i'm doing:
>
> class Foo():
> pass
>
> x = 'Foo'
>
> How do i use 'x' to create an instance of class Foo?
Use the builtin function `getattr` on the module that contains
the class named "Foo".
For example:
module.Foo
is equivelant to:
getattr(module, "Foo")
Here is an interactive session:
py> import Tkinter
py> Tkinter.Label
<class Tkinter.Label at 0x023BE5A8>
py> getattr(Tkinter, "Label")
<class Tkinter.Label at 0x023BE5A8>
--
https://mail.python.org/mailman/listinfo/python-list