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

Use some new Python3 types #10432

Merged
merged 2 commits into from Feb 17, 2018
Merged

Use some new Python3 types #10432

merged 2 commits into from Feb 17, 2018

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Feb 12, 2018

PR Summary

This is a PoC of using some new Python 3 types: enum.Enum in a couple places, and replace cbook.Bunch by types.SimpleNamespace. This will fail CI right now.

PR Checklist

  • Has Pytest style unit tests
  • Code is PEP 8 compliant
  • [N/A] New features are documented, with examples if plot related
  • Documentation is sphinx and numpydoc compliant
  • [N/A] 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

@QuLogic QuLogic added this to the v3.0 milestone Feb 12, 2018
tips=tips, text=text, texts=texts))
self.diagrams.append(types.SimpleNamespace(patch=patch, flows=flows,
angles=angles, tips=tips,
text=text, texts=texts))
Copy link
Member

Choose a reason for hiding this comment

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

As illustrated here, types.SimpleNamespace is a lot more characters to type than Bunch, and the pep8 line length limit is quite small. Just a thought: how about from types import SimpleNamespace as Bunch?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't see the need for a shortcut like that. There are other ways to wrap it, such as the one I just pushed.

@QuLogic
Copy link
Member Author

QuLogic commented Feb 17, 2018

Rebased due to conflicts.

@anntzer anntzer merged commit 637b649 into matplotlib:master Feb 17, 2018
@QuLogic QuLogic deleted the py3-types branch February 17, 2018 23:16
@QuLogic QuLogic added the Py3k label Feb 18, 2018
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