> > but for the record, the way to use exec is like this: > > exec("object1 = classname()") > I failed to make that work. So back to the original question. How to > make an instance named according to a string inside a variable? I > guess it should be in the top-level namespace, not inside a list or > dictionary.
I think what you want is more like: classclass = eval(classname) x = classclass(...args...) <http://coils.hg.sourceforge.net/hgweb/coils/coils/file/2c7847ef0527/src/coils/protocol/dav/davroot.py> -- OpenGroupware developer: awill...@whitemice.org <http://whitemiceconsulting.blogspot.com/> OpenGroupare & Cyrus IMAPd documenation @ <http://docs.opengroupware.org/Members/whitemice/wmogag/file_view> -- http://mail.python.org/mailman/listinfo/python-list