> Code: > > value = self.dictionary.get(keyword)[0] > > if value == "something": > somethingClass.func() > elsif value == "somethingElse": > somethingElseClass.func() > elsif value == "anotherthing": > anotherthingClass.func() > elsif value == "yetanotherthing": > yetanotherthingClass.func() > > Is it possible to store these function calls in a dictionary so that I > could just call the dictionary value?
How about (untested): def x(): print 'x' def y(): print 'y' funcdict={ 'valuex': x, 'valuey': y } funcdict['valuex']() -- http://mail.python.org/mailman/listinfo/python-list