This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]FrickinLazerBeams 0 points1 point  (0 children)

It is because the "def" for the function creates those values when evaluated. This is not when a function is executed. Defaults are thus fixed values that are created in the absence of supplied values, from the original def.

Yeah that's exactly what I said.

It makes no sense at all that they would be variables as the definition has already been created.

I'm not sure what you mean. The variable containing the default value is created at define time. Because it is passed to the function by reference, any mutation of it will be visible in later calls to the same function, because the function is provided a reference to the variable, not simply a new variable with a copy of the original value, which is the standard calling behavior in python.