Re:Common Python Mistakes
by marcosdumay on Thursday May 08, 2014 @11:40AM
(#7715856)
Kilink's comment apply again.
If you define several functions at different times, the default argument will be evaluated each time you define a new function. You'll have the same behaviour if you keep reassigning lambdas at the same function name, or if you keep edditing the globals.
You are misunderstanding how dynamic Python is. And, yes, the part about "module load time" was a simplification.
If you define several functions at different times, the default argument will be evaluated each time you define a new function. You'll have the same behaviour if you keep reassigning lambdas at the same function name, or if you keep edditing the globals.
You are misunderstanding how dynamic Python is. And, yes, the part about "module load time" was a simplification.