From: nathan virgil <sdragon1...@gmail.com> > selection = raw_input("Choice: ") > choices = {"0":quit, "1":crit.talk, "2":crit.eat, "3":crit.play} > choice = choices[selection] > choice() > > ...so that I can call methods from a dictionary > the problem I'm running into with this is that > I can't pass any perimeters through the dictionary. > What can I do?
choices = {'a': lambda: crit.eat(2), 'b': lambda: crit.eat(4), ...} choice = choices[selection] choice() http://www.diveintopython.org/power_of_introspection/lambda_functions.html _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor