Skip to content

Removed occurences of mutable kwargs#139

Merged
michaelckelly merged 1 commit intoplaid:masterfrom
mattiskan:mattis-replace-mutable-kwargs
Feb 25, 2019
Merged

Removed occurences of mutable kwargs#139
michaelckelly merged 1 commit intoplaid:masterfrom
mattiskan:mattis-replace-mutable-kwargs

Conversation

@mattiskan
Copy link
Copy Markdown
Contributor

Kwargs are evaluated import time and for objects (in this case the dict) the function is passed a reference to the same dict on each call. This is an anti-pattern because it introduces state in functions in an unexpected way (if the dict is mutated then subsequent function calls are affected by this mutation too).

This change is backwards compatible and removes risk of subtle and hard-to-identify bugs.

@davidzhanghp
Copy link
Copy Markdown
Contributor

can we add a lint rule to prevent this in the future

@michaelckelly michaelckelly merged commit 3614278 into plaid:master Feb 25, 2019
@mattiskan mattiskan deleted the mattis-replace-mutable-kwargs branch February 25, 2019 22:12
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.

3 participants