Skip to content

Cleanups #9125

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
Sep 1, 2017
Merged

Cleanups #9125

merged 2 commits into from
Sep 1, 2017

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Aug 30, 2017

I noticed while working on #9124 that some old codepaths seem to assume keys don't necessarily exist in rcParams, which may possibly have been the case a long time ago but is not the case anymore today -- so remove all rcParams.get by indexing into rcParams.

... except in axis3d which tries to look up the nonexistent ztick.major.width and ztick.color, so keep the fallback on xtick.major.width and xtick.color (I did not add the whole suite of ztick.* rcParams to rcsetup because in that case we'd better make sure all of them are respected, which is another project in itself). Now that I was there I could as well do some style cleanups in axis3d.py.

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

@tacaswell tacaswell added this to the 2.1 (next point release) milestone Aug 31, 2017
if prev and prev.latex_header == latex_header and prev.texcommand == texcommand:
if rcParams.get("pgf.debug", False):
# Check if the previous instance of LatexManager can be reused.
if (prev and prev.latex_header == latex_header
Copy link
Member

Choose a reason for hiding this comment

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

order of operations unclear here (and yes I know was unclear previously too), what about instead using parenthesis around each == pair?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it is pretty well known that "and" and "or" have lower priority than comparison operators. Relying on this basically occurs everywhere throughout the codebase.

Copy link
Member

Choose a reason for hiding this comment

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

shrugs I never remember this stuff, but not gonna hold up the review over it.

Copy link
Member

Choose a reason for hiding this comment

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

explicit is better than implicit, but too many () can also make it confusing by adding to visual noise. In this case I think it is ok without ()

@tacaswell tacaswell merged commit 83fa71f into matplotlib:master Sep 1, 2017
@anntzer anntzer deleted the cleanup branch September 1, 2017 02:20
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.

4 participants