P
Peter Hansen
D said:Since you and Steve Holden agree that a case statement is useful, why
don't you propose it for python, or add it to the wiki page for Python
3000.
Two simple reasons.
1. You forgot my previous comment that "in current Python the equivalent
approach is, of course, a dictionary of some kind, though it's arguable
whether this is as clean in many cases as a case statement would be."
2. Just because something is "useful" doesn't mean it should be added to
Python. The bar should be set much higher, and should include at least
"and significantly better than any existing alternative way of doing the
same thing." Now go read point 1 again... ;-)
My point was not to suggest that I want a case statement in Python, nor
even that a case statement is a good thing to have in a language (though
it might be... it's not my place to say). My point was simply to point
out that performance is not the only reason to use a case statement.
-Peter