On 6/21/06, Nick Coghlan <[EMAIL PROTECTED]> 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/)
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to