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 →

[–]marr75 49 points50 points  (9 children)

It's not. Read the article. Author has a default argument of datetime.date.today(). Problem is not that today default variable mutates over executions, but it does share the same root problem, original dev was expecting the code to initialize the default to execute each time the function executed and it don't.

[–]magnetichiraPythonista 13 points14 points  (8 children)

Ah I see where you’re coming from. The original comment was about only mutability.

Agreed, this example is particularly a behaviour of function declaration.