Skip to content
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

PEP8 fixes on _cm.py #1394

Merged
merged 1 commit into from Nov 7, 2012
Merged

PEP8 fixes on _cm.py #1394

merged 1 commit into from Nov 7, 2012

Conversation

NelleV
Copy link
Member

@NelleV NelleV commented Oct 14, 2012

PEP8 fixes on the module _cm

28: lambda x: np.abs((3 * x - 1) / 2),
29: lambda x: np.abs((3 * x - 2) / 2),
28: lambda x: np.abs((3 * x - 1) / 2),
29: lambda x: np.abs((3 * x - 2) / 2),
Copy link
Member

Choose a reason for hiding this comment

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

Is x always a nonzero integer? If so then, at present, this calculation rounds down on division by two. Since I am not sure what color(x) does, this concerns me a little. The line above, however, np.abs((3 * x - 1) / 2) is fine, since 3x-1 is always even.

Copy link
Member

Choose a reason for hiding this comment

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

Note the "from future import division" at the top of the file. That means dividing by 2 gives a floating point result if necessary, so there is no rounding down.

Copy link
Member

Choose a reason for hiding this comment

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

Awesome, I learned something new. Thanks.

@dmcdougall
Copy link
Member

If someone can explain L153 then this gets my +1.

efiring added a commit that referenced this pull request Nov 7, 2012
@efiring efiring merged commit 5bcd2d2 into matplotlib:master Nov 7, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants