Python OOP Problem

Миклухо mikluxo at gmail.com
Mon Dec 28 06:48:52 EST 2009


Hi, all. My problem is:
1) I have a database(postgresql)
2)I'm getting some string from database(string is a classname -
written by me).
3)I need to construct new object from this string.
In java it's done by Class.forName().newInstance();

For instance:
1)I receive the string: "MyObject".
2)o = MyObject();
3)o.myfunction();

Saw this link http://stackoverflow.com/questions/452969/does-python-have-an-equivalent-to-java-class-forname,
but it doesn't work for me. May be I do something wrong. I just
started to learn python. Help, please.
PS: Sorry for poor English.
Mikluxo



More information about the Python-list mailing list