[Python-Dev] PEP 3103: A Switch/Case Statement (original) (raw)
Eric Sumner kd5bjo at gmail.com
Wed Jun 28 20:25:47 CEST 2006
- Previous message: [Python-Dev] PEP 3103: A Switch/Case Statement
- Next message: [Python-Dev] PEP 3103: A Switch/Case Statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
> Forget subroutines for a moment - the main point of the thread was the > idea that the dispatch table was built explicitly rather than > automatically - that instead of arguing over first-use vs. > function-definition, we let the user decide. I'm sure that my specific > proposal isn't the only way that this could be done.
But anything that makes the build explicit is going to be so much more ugly. And I still think you're trying to solve the wrong problem.
Only if the programmer has to see it. The dispatch table need not include the behaviors of each of the cases; it only needs to define what the cases are. In most of the use cases I've seen, switch is used to define behavior for different values of an enumeration. The dispatch table for an enumeration can be built wherever the values for the enumeration are defined (such as in a module). Programmers don't need to bother with making a dispatch table unless they are defining enumeration values themselves.
-- Eric Sumner
Note: I sent an email yesterday with a proposal to this effect, but it seems to have been lost. If anybody wants, I can resend it.
- Previous message: [Python-Dev] PEP 3103: A Switch/Case Statement
- Next message: [Python-Dev] PEP 3103: A Switch/Case Statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]