Anonymous user
Conditional structures: Difference between revisions
→Function dispatch dictionary
Line 3,030:
}
# ...
results = dispatcher.get(x, boz)()</lang>
<lang python># Or without the temp variable
# (it's up to the reader to decide how "pythonic" this is or isn't)
results = {
0: foo,
1: bar,
|