On Wed, 14 Jan 2009 13:53:52 +0530, Krishnakant wrote: > Hi steevan, > I liked this idea of dispatchTable. > is it possible to say some thing like inst = dispatchTable{"ham"} > according to me, inst will become the instance of class ham.
Yes, that works, provided you fix the syntax. (You used {} instead of square brackets.) There's nothing special about dispatching: you look up the dict with a key, and that returns a class. You then call that class to create a class instance as if you were calling it directly by name. > Another > thing to note is that all the classes are in different modules. So where > do I create the dict of classes mapped with the name? That's up to you. -- Steven -- http://mail.python.org/mailman/listinfo/python-list