Skip to content

CLN: Replace first_not_none function with default argument to next #33343

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 2 commits into from
Apr 10, 2020

Conversation

rhshadrach
Copy link
Member

  • closes #xxxx
  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@@ -1232,20 +1226,19 @@ def first_not_none(values):
key_index = None

# make Nones an empty object
v = first_not_none(values)
Copy link
Member

Choose a reason for hiding this comment

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

it looks like there are two places where first_not_none is called, and values can change in between them

Copy link
Member Author

@rhshadrach rhshadrach Apr 6, 2020

Choose a reason for hiding this comment

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

Ah, thanks. I was thinking that it's only the kind of object being used and so the second call was not needed, but it really should be updated. I moved the update into the if block so that it is only done when needed. For what it's worth, I added an assert to see if the value order ever did change and it never got triggered by the tests.

@jreback jreback added the Clean label Apr 10, 2020
@jreback jreback added this to the 1.1 milestone Apr 10, 2020
@jreback jreback merged commit b9cf9be into pandas-dev:master Apr 10, 2020
@jreback
Copy link
Contributor

jreback commented Apr 10, 2020

thanks @rhshadrach

@rhshadrach rhshadrach deleted the first_not_none branch July 11, 2020 16:02
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