Default Parameters to function!

Fredrik Lundh effbot at
Wed Mar 15 22:13:13 CET 2000

Yuriy Gorvitovskiy <yuriy at> wrote:
> I want to make a request to the Python developers to change the way of
> default parameters initialization from "when function definition is
> executed" to "when function executed".

the default value can be an arbitrary expression, and it's
evaluated in the same context, and at the same time, as
the function or method definition itself.  cannot be much
simpler, can it?

so if you want to change this, please explain:

-- in which context you want to evaluate the default value

-- how to pass values between scopes

-- how to bind local values so they can be used in lambdas

-- how to handle exceptions in the default value expression

-- how to explain that python suddenly runs much slower

-- how to change this without breaking existing code


> I spend half of the days to figure out this problem.

hint: reading the FAQ can help:


More information about the Python-list mailing list