[Python-Dev] Simple Switch statement (original) (raw)
Raymond Hettinger raymond.hettinger at verizon.net
Sun Jun 25 20:13:37 CEST 2006
- Previous message: [Python-Dev] Simple Switch statement
- Next message: [Python-Dev] Simple Switch statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Sorry, no go. You can say "supports key use cases found in real code" as often as you like,
Those were not empty words. I provided two non-trivial worked-out examples taken from sre_constants.py and opcode.py. Nick provided a third example from decimal.py. In all three cases, the proposal was applied effortlessly resulting in improved readability and speed. I hope you hold other proposals to the same standard.
If you want to provide a solution for the constantification issue, let's discuss that first and then come back here.
No thanks. That is its own can of worms. The obvious solutions (like const declarations, macros, or a syntax to force compile-time expression evaluation) are unlikely to sit well because they run afoul Python's deeply ingrained dynamism.
The switch-case construct in C uses constant cases but depends on macros to make the constants symbolic. Is that where we want to go with Python? If so, that is most likely a Py3k discussion.
In contrast, the proposed simple switch statement is something we could have right away. I will likely write-up a PEP and get a sample implementation so we can discuss something concrete at EuroPython.
Raymond
- Previous message: [Python-Dev] Simple Switch statement
- Next message: [Python-Dev] Simple Switch statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]