David Harvey wrote:
>     if x in ("abc", "def", "xyz"):
>         doStuff()
>     elif x in ("pqr", "tuv", "123"):
>         doOtherStuff()
>     elif ...

If the code really looks like this:
     # one-time-only code
     big_dispatch_table = {}
     for function, keys in [
             (doStuff, ["abc", "def", "xyz"]),
             (doOtherStuff, ["pqr", "tuv", "123"]),
              ... ]:
         for key in keys:
             big_dispatch_table[key] = function


Then your actual code goes something like:

     big_dispatch_table[x]()

--Scott David Daniels
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to