Skip to content

CLN: Use sentinel values instead of mutable default arguments #11827

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 1 commit into from
Dec 15, 2015
Merged

CLN: Use sentinel values instead of mutable default arguments #11827

merged 1 commit into from
Dec 15, 2015

Conversation

proinsias
Copy link
Contributor

From Quantified Code:

Mutable list or dictionary used as default argument to a method or function. Python creates a single persistent object and uses it for every subsequent call in which the argument is left empty. This can cause problems if the program was expecting the function to return a new list or dictionary after every call. Use a sentinel value to denote an empty list or dictionary.

@@ -355,7 +355,7 @@ def rolling_corr_pairwise(df1, df2=None, window=None, min_periods=None,

Copy link
Contributor

Choose a reason for hiding this comment

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

don't change code in here, this entire module is being refactored

@jreback
Copy link
Contributor

jreback commented Dec 12, 2015

ok, but really need to limit scope to tested code, and need to be really careful changing the tests

@jreback jreback added the Clean label Dec 12, 2015
@proinsias
Copy link
Contributor Author

Should be all set now.

@jreback jreback added this to the 0.18.0 milestone Dec 15, 2015
@jreback
Copy link
Contributor

jreback commented Dec 15, 2015

this is fine. ping when green.

@proinsias
Copy link
Contributor Author

All checks have passed.

jreback added a commit that referenced this pull request Dec 15, 2015
CLN: Use sentinel values instead of mutable default arguments
@jreback jreback merged commit 92cf968 into pandas-dev:master Dec 15, 2015
@jreback
Copy link
Contributor

jreback commented Dec 15, 2015

thanks!

@proinsias proinsias deleted the mutable_default_args branch December 15, 2015 20:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants