Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Minor simplifications to backend_svg. #12423

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
Oct 6, 2018
Merged

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented Oct 6, 2018

PR Summary

PR Checklist

  • Has Pytest style unit tests
  • Code is Flake 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

same_y = False
break
if same_y:
if len({y for x, y, t in chars}) == 1:
Copy link
Member

Choose a reason for hiding this comment

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

This is shorter - but not a simplification (at least for me).

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's much clearer what this does...
I can do

same_y = (len(...) == 1)
if same_y: ...

I guess that gets the best of both worlds?

Copy link
Member

Choose a reason for hiding this comment

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

Its the curly braces: I have no idea what that does.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's a set comprehension: https://docs.python.org/3/tutorial/datastructures.html#sets
The question is whether all y's are the same. So you build a set with all y's and check whether its size is 1.

Copy link
Member

@jklymak jklymak Oct 6, 2018

Choose a reason for hiding this comment

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

OK, I see. Each chars is 3-long, so x,y, t is juts unpacking the list. Suggest short comment:

# check if all the y values (second element of each chars) are the same using set comprehension.

Copy link
Member

@jklymak jklymak left a comment

Choose a reason for hiding this comment

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

Would prefer the comment. Thanks for walking me through it

@anntzer
Copy link
Contributor Author

anntzer commented Oct 6, 2018

added comment

Copy link
Member

@QuLogic QuLogic left a comment

Choose a reason for hiding this comment

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

+ one typo

# coordinate will be flipped when this characters are
# used.
# We store the character glyphs w/o flipping. Instead, the
# coordinate will be flipped when this characters are used.
Copy link
Member

Choose a reason for hiding this comment

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

these characters or this character

@jklymak jklymak added this to the v3.1 milestone Oct 6, 2018
@jklymak jklymak merged commit b283da7 into matplotlib:master Oct 6, 2018
@jklymak
Copy link
Member

jklymak commented Oct 6, 2018

CI passed before minor typo in comment fix, so merging...

@anntzer anntzer deleted the svg-cleanup branch October 7, 2018 02:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.