-
Notifications
You must be signed in to change notification settings - Fork 228
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
Do not mute mutable arguments #251
Comments
Thanks for the report! I'd be happy to review a PR that adds the appropriate copy, but please keep the same default value since some downstream dependencies rely on that behavior. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The current implementation of
corner_impl
is muting its mutable arguments, like here:The dictionary
hist_kwargs
as seen from the scope callingcorner
is changed after the call.Minimal example:
The object
mydict
was changed by the call tocorner
, which is unexpected.This could be resolved by simply adding
hist_kwargs = dict(hist_kwargs)
, because then the rest of the code is working on a copy of the dictionary. Of course the user could do this as well, but it would be nicer if the user wouldn't need to bother. Also, this becomes more annoying when passing this argument as a kwarg itself, because then acopy.deepcopy
becomes necessary to ensure that what is passed in stays the same.(If this will be implemented: If the default for
hist_kwargs
would not beNone
, but[]
, the if checking for None wouldn't also be needed anymore, becausedict([])
gives an empty dictionary.)The text was updated successfully, but these errors were encountered: