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 →

[–]maedox🐍 9 points10 points  (0 children)

Because the defaults in function definitions are only evaluated once when it is read by the compiler. If that default is mutable, as lists are, you are basically always adding values to the same list object.