>> name2class = { "MyObject" : MyObject,
>>                "MyOtherObject" : MyOtherObject,
>>                "Etc" : Etc }
>>
>> Then, when you receive the string class_name, you do
>>
>> o = name2class[class_name]
>> o.myfunction()
>>
> The class needs to be instantiated, so the one line should be as
> follows:
> 
> o = name2class[class_name]()

Oops - thanks for pointing that out.

Martin
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to