a python pitfall
Skip Montanaro
skip.montanaro at gmail.com
Thu May 14 14:55:23 EDT 2015
> I saw the following example at
> http://nafiulis.me/potential-pythonic-pitfalls.html#using-mutable-default-arguments
> and did not believe the output produced and had to try it for myself....
Pylint (and perhaps other Python "linters") would, I think, warn you
that you were using a mutable object as a default. It's more obvious
that the list is being reused if you call foo with different values
each time.
Skip
More information about the Python-list
mailing list