An alternative way of doing what you need that doesn't add any syntax, is more 
readable, runs faster, scales better and has long been used as the reason that 
python doesn't need a case statement would be:

# Dictionary of which actions to take  for foo
foo_action_dict = {
    'a':a,
    'b':b,
    'c':c,
}
def foo_default_handler():
    """ Handler for remaining cases of foo """
    print("Input value must be one of", foo_action_dict.keys())

# Call the appropriate action for foo:
action_dict.get(foo, foo_default_handler)()

[Steve Barnes] 
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/A52OOY52V3IHGRNFGZPEENHW42ICCU6V/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to