[Python-Dev] Switch statement
Jim Jewett
jimjjewett at gmail.com
Fri Jun 23 23:20:05 CEST 2006
More information about the Python-Dev mailing list
Fri Jun 23 23:20:05 CEST 2006
- Previous message: [Python-Dev] Switch statement
- Next message: [Python-Dev] Switch statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 6/23/06, Guido van Rossum <guido at python.org> wrote: > Here are a few examples showing my objections against first-use. [Problem with nested scopes; today this usually shows up as (invalid) bug reports about lambda, in which failure to bind a "default" variable "to itself" causes it to take on the value at the end of the loop, instead of the value of the index when defined.] [Problem with using a parameter as a case selector -- at least these aren't available at definition time.] > With the def-time rule, you'd have to work a lot harder to construct > an example that works differently than the casual reader would expect. Anything which use the same names in the local scope, particularly if those names are themselves marked final (or static). a=1 b=2 c=3 def f(v): a=4 # This gets ignored? final b=5 # But what about this? It is local, but a constant known in advance switch v: case in (a, b, c): ... final c=6 # Also a constant, but textually after the case keyword. -jJ
- Previous message: [Python-Dev] Switch statement
- Next message: [Python-Dev] Switch statement
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-Dev mailing list