Default parameters
Terry Reedy
tjreedy at udel.edu
Wed Dec 17 23:18:42 EST 2003
"Stian Søiland" <stain at stud.ntnu.no> wrote in
message
news:slrnbtvte6.tnk.stain at ozelot.stud.ntnu.no...
> When is this issue going to be resolved? Enough
newbie-pythoners have
> made this mistake now.
I am puzzled as to why. When I learned Python, I
read something to the effect that default value
expressions are evaluated at definition time. I
understood that the resulting objects were saved
for later use (parameter binding) when needed (as
default for value not given). I believed this and
that was that.
> Why not evaluate the parameter lists at calltime
instead of definition
> time?
Run time code belongs in the body of the function
and the corresponding byte code in the code
object. To me anyway.
Terry J. Reedy
More information about the Python-list
mailing list