Hacker News new | ask | show | jobs
by deaddodo 2689 days ago
Who.....codes like this? Use a method dispatch instead, and have the dispatcher worry about throwing the exception:

    try:
        DispatchController.dispatch()
    except:
        raise DispatchFailed()
And/or use a lookup table. Especially since methods, classes, decorators, etc are all first class citizens in Python.