Can global variable be passed into Python function?

Marko Rauhamaa marko at pacujo.net
Fri Feb 28 06:38:11 EST 2014


Chris Angelico <rosuav at gmail.com>:

> Python currently has dispatch tables and if/elif chains, and a strong
> cultural aversion to switch. You could change that by coming up with
> some *really* awesome proposal, but you'll be fighting against the
> tide a bit.

It's easy have a "cultural aversion" when the language doesn't provide
the facility.

Switch statements provide for excellent readability in parsers and state
machines, for example. They also allow the Python compiler to optimize
the statement internally unlike long if-else chains.


Marko



More information about the Python-list mailing list