Skip to content

Remove the mutable from the defaults argument. #973

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 23, 2022
Merged

Conversation

MaxJPRey
Copy link
Collaborator

Severe side effects can arose when using mutable objects as default argument.
Indeed the default values of the argument will be evaluated the first time the method is called.
In the subsequent method calls, the same value is used.

@MaxJPRey MaxJPRey marked this pull request as draft March 21, 2022 14:50
@MaxJPRey MaxJPRey marked this pull request as ready for review March 21, 2022 19:24
@MaxJPRey MaxJPRey requested a review from maxcapodi78 March 22, 2022 08:16
Copy link
Contributor

@akaszynski akaszynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Collaborator

@maxcapodi78 maxcapodi78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@maxcapodi78 maxcapodi78 merged commit ab885f8 into main Mar 23, 2022
@maxcapodi78 maxcapodi78 deleted the fix/issue_972 branch March 23, 2022 09:02
@MaxJPRey MaxJPRey linked an issue Mar 23, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove the mutable from the defaults argument.
3 participants