On Jun 19, 12:40 pm, asincero <[EMAIL PROTECTED]> wrote: > Which is better: using an if/else construct to simulate a C switch or > use a dictionary? Example:
Whichever results in the clearest code that meets the performance requirements. FWIW, if you define the dictionary beforehand, the dict solution is O(1) while if/else is O(N), which can be important. -Mike -- http://mail.python.org/mailman/listinfo/python-list