[Python-Dev] Re: switch statement
mal at egenix.com
Wed Apr 20 23:40:25 CEST 2005
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
> 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.
Professional Python Services directly from the Source (#1, Apr 20 2005)
>>> Python/Zope Consulting and Support ... http://www.egenix.com/
>>> mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/
>>> mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::
More information about the Python-Dev