[Tutor] python's default argument value handling in functions - weird syntax? problem grappling with the concept

Mike Bell ternary at gmail.com
Wed Feb 9 22:12:22 CET 2005


The function's local variable L is not static, but "default argument
value" is, which is what the documentation means when it says that it
will evaluate these only once.  When the default value is a list (in
your code, not "the empty list" but a list which happens to be empty
when the default arguments are being evaluated), that same object is
used every time the function is called.

mike


More information about the Tutor mailing list