[Python-Dev] PEP 3103: A Switch/Case Statement
python-dev at zesty.ca
Mon Jun 26 21:48:14 CEST 2006
On Mon, 26 Jun 2006, Guido van Rossum wrote:
> I've written a new PEP, summarizing (my reaction to) the recent
> discussion on adding a switch statement. While I have my preferences,
> I'm trying to do various alternatives justice in the descriptions.
Thanks for writing this up!
The section that most draws my attention is "Semantics", and i guess
it isn't a surprise to either of us that you had the most to say
from the perspective you currently support (School II). :) Let me
suggest a couple of points to add:
- School I sees trouble in the approach of pre-freezing a dispatch
dictionary because it places a new and unusual burden on the
programmer to understand exactly what kinds of case values are
allowed to be frozen and when the case values will be frozen.
- In the School II paragraph you say "Worse, the hash function
might have a bug or a side effect; if we generate code that
believes the hash, a buggy hash might generate an incorrect
match" -- but that is primarily a criticism of the School II
approach, not of the School I approach as you have framed it.
It's School II that mandates that the hash be the truth.
(It looks to me like what you're actually criticizing here is
based on some assumptions about how you think School I might
be implemented, and having taken School I a number of steps
down that (unexplained) road you then see problems with it.)
Also, why is the discussion of School II mostly an argument against
School I? What about describing the advantages of each school?
More information about the Python-Dev