On 6/21/06, Nick Coghlan <ncoghlan at gmail.com> wrote: > There's some benefit to "first time it's executed" though: > a. it allows access to the local namespace And how would that be a good thing? It just begs for confusion if the local variable doesn't always have the same value. (Yes, globals may vary too, but less likely, since global *variables* (i.e. that actually vary) are generally considered a bad idea. There's no such taboo for local variables. :-) > b. it uses the same semantics at module level as it does in a function Hm, I hadn't thought of that one yet. > If we go with 'at function definition time', then neither of those is true. > I'm actually curious how a module level switch statement would work at all in > that case, without either falling back on the "first time it's executed" > definition, or else not permitting switch statements in module level code. After thinking about it a bit I think that if it's not immediately contained in a function, it should be implemented as alternative syntax for an if/elif chain. -- --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4