I\'m trying to create a game for my little sister. It is a Virtual Pet sort of thing and the Pet has toys to play with.
I created a class Toy and want t
Toy
Given your edit i assume you have the class name as a string and want to instantiate the class? Just use a dictionary as a dispatcher.
class Foo(object): pass class Bar(object): pass dispatch_dict = {"Foo": Foo, "Bar": Bar} dispatch_dict["Foo"]() # returns an instance of Foo