Can global variable be passed into Python function?

Marko Rauhamaa marko at pacujo.net
Sun Mar 2 03:00:36 EST 2014


Roy Smith <roy at panix.com>:

> Python already has a switch statement.  It's just spelled funny...
>
> [...]
>
> try:
>    raise value
> except Case1:
>    print "did case 1"
> except (Case2, Case3):
>    print "did either case 2 or 3"
> else:
>    print "did default"

Not bad! Definitely worth considering.

> No fall-through, however.

Fall-trough is an unfortunate C syntax accident, not a feature worth
emulating.


Marko



More information about the Python-list mailing list