[Python-Dev] PEP 3103: A Switch/Case Statement (original) (raw)

Guido van Rossum guido at python.org
Tue Jun 27 17:13:46 CEST 2006


On 6/27/06, Robin Bryce <robinbryce at gmail.com> wrote:

> PEP 3103, When to Freeze the Dispatch Dict/Option 1

2 things resonated with me for Raymond's proposal and the follow up: - It seemed agnostic to almost all of the independently contentious issues.

Except for the need to use named constants.

- "is defined tightly enough to allow room for growth and elaboration over time" [Raymond]. In particular it left room for const/static/only/cached/etc to come along later.

I think its worth acknowledging this in the PEP.

Search for Raymond's name. It's there.

Is nothing better than something in this case ? I don't know.

> I think we need a PEP for const/static/only/cached/precomputed or > whatever people like to call it. > > Once we have (say) static, I think making the case expressions static > by default would still cover all useful cases, and would allow us to > diagnose duplicate cases reliably (which the if/elif chain semantics > don't allow IIUC). If the expectation is that static/const will evolve as a sibling pep, does this not make Raymond's suggestion any more appealing, even a little ?

No, then School Ia becomes more appealing. Raymond's proposal is unpythonic by not allowing expressions.

Is it unacceptable - or impractical - to break the addition of switch to python in two (minor version separated) steps ?

But what's the point? We have until Python 3000 anyway.

-- --Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list