[Python-Dev] Re: switch statement (original) (raw)
Shannon -jj Behrens jjinux at gmail.com
Thu Apr 21 02:59:04 CEST 2005
- Previous message: [Python-Dev] Re: switch statement
- Next message: [Python-Dev] Re: switch statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 4/20/05, M.-A. Lemburg <mal at egenix.com> wrote:
Fredrik Lundh wrote: > PS. a side effect of the for-in pattern is that I'm beginning to feel > that Python > might need a nice "switch" statement based on dictionary lookups, so I can > replace multiple callbacks with a single loop body, without writing too > many > if/elif clauses.
PEP 275 anyone ? (http://www.python.org/peps/pep-0275.html) My use case for switch is that of a parser switching on tokens. mxTextTools applications would greatly benefit from being able to branch on tokens quickly. Currently, there's only callbacks, dict-to-method branching or long if-elif-elif-...-elif-else.
I think "match" from Ocaml would be a much nicer addition to Python than "switch" from C.
-jj
-- I have decided to switch to Gmail, but messages to my Yahoo account will still get through.
- Previous message: [Python-Dev] Re: switch statement
- Next message: [Python-Dev] Re: switch statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]