> i guess i need to pass wield an object somehow instead of a string.
> can anyone point in the right direction?
AS ever converting strings to objects is a job for a doictionary. And
remember that classe3s are objects too.
So simply register each class you define in a dictionary of classes against
their name
classes = {'Room':Room, 'Player': Player, 'Sword':Sword,...}
class Player:
def wield(self,what):
print type(what)
print 'you wield',what
self.wielded = classes[what]() # an instance of what...
HTH,
Alan G
Author of the learn to program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor