Skip to content
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

Some default argument values are dict (which are mutable), a Python anti-pattern #103

Open
agzimmerman opened this issue Dec 8, 2020 · 0 comments

Comments

@agzimmerman
Copy link
Member

https://docs.python-guide.org/writing/gotchas/#mutable-default-arguments

For the most part I did an okay job of using None as the default argument value and then setting the mutable value in __init__; but there are many cases where I use a dict which is mutable and can lead to all sorts of unintended behavior. For example, the base class Simulation has a dict as the default value for solver_parameters.

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

No branches or pull requests

1 participant