Re: Loading classes dynamically

2005-08-14 Thread Steven Bethard
Ramza Brown wrote: > try: > load = eval('%s(props)' % (props['plugin.generate'])) > except: > > It works, doesnt seem very safe. Where props['plugin.generate'] is a > class name string. And 'props' is the first arg in the constructor. Where is the class defined? The right answer to this

Loading classes dynamically

2005-08-14 Thread Ramza Brown
What is the most pythonic way to load a class and instaniate an object dynamically. Right now, I am using eval: try: load = eval('%s(props)' % (props['plugin.generate'])) except: It works, doesnt seem very safe. Where props['plugin.generate'] is a class name string. And 'props' is the