Dynamic creation of an object instance of a class by name

Andre Meyer meyer at acm.org
Wed Apr 7 18:56:07 EDT 2004


Right, ok, well, I do not assume to know what classes can be instantiated, thus
anything like accessing globals() is not likely to help, sorry. The eval()
version works pretty ok so far. I am develpoing a module of which other people
can make use of by developing their own subclasses, but they need to be
instantiated by my code. Eval() does the trick for me or is there a better way,
assuming you do not need to know which class it might be beforehand?
btw I LOVE dynamicity... ;-)

kind regards
Andre





More information about the Python-list mailing list