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

when summing integers, use numpy.sum. #537

Merged
merged 1 commit into from Dec 10, 2018

Conversation

Projects
None yet
1 participant
@rainwoodman
Copy link
Member

rainwoodman commented Dec 10, 2018

On some occasions when code is ran in e.g. a notebook,
numpy.sum is imported to replace sum, and the behaviro of
numpy.sum([]) is to 0.0 rather than builtin.sum([]) which returns 0.

numpy.sum([]) returning 0.0 causes downstream code expecting integers to fail,
thus copying the code out of nbodykit won't work.

We shall not serve as an poor example in this context.

when summing integers, use numpy.sum.
On some occasions when code is ran in e.g. a notebook,
numpy.sum is imported to replace sum, and the behaviro of
numpy.sum([]) is to 0.0 rather than builtin.sum([]) which returns 0.

numpy.sum([]) returning 0.0 causes downstream code expecting integers to fail,
thus copying the code out of nbodykit won't work.

We shall not serve as an poor example in this context.

@rainwoodman rainwoodman merged commit bf140a0 into bccp:master Dec 10, 2018

1 check was pending

continuous-integration/travis-ci/pr The Travis CI build is in progress
Details

@rainwoodman rainwoodman deleted the rainwoodman:sum-to-float branch Dec 10, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment