[Python-Dev] Switch statement

Jim Jewett jimjjewett at gmail.com
Fri Jun 23 22:32:48 CEST 2006

In http://mail.python.org/pipermail/python-dev/2006-June/066399.html, PJE wrote:
>> Python prefers to evaluate expressions in the order that they
>> appear in source code, ... "first-time use" preserves that
>> property; "function definition time" does not.

Guido wrote:
> But first-time has the very big disadvantage IMO that there's no
> safeguard to warn you that the value is different on a subsequent
> execution -- you just get the old value without warning.

That is true either way, and is already true with computed default
arguments.  The only difference is that your mental model has even
longer to become inconsistent.  (The time between definition and first

First time use also lets you use a constant (such as a dotted name
from another module) that may not yet be defined when the function is
defined, but will be defined before the function is used.


More information about the Python-Dev mailing list