fipy
fipy copied to clipboard
Remove mutable default arguments
As documented (under "Default parameter values are evaluated from left to right when the function definition is executed"), using mutables as default arguments can have unexpected results.
This is done in most of the Viewer
definitions (limits={}
), as well as a handful of other cases.
As documented:
A way around this is to use
None
as the default, and explicitly test for it in the body of the function
See also https://stackoverflow.com/questions/26320899/why-is-the-empty-dictionary-a-dangerous-default-value-in-python.