Thanks to visit codestin.com
Credit goes to github.com

Skip to content

add __repr__ to GridSpecBase #11492

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 1 commit into from
Jun 27, 2018
Merged

Conversation

timhoffm
Copy link
Member

PR Summary

While playing around with gridspecs I found it convenient to have the repr of GridSpec show the number of columns and rows.

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.

OK< but __repr__ or __str__? I think we decided __str__ could be more verbose. OTOH, this is hardly overbearingly noisy.

@jklymak
Copy link
Member

jklymak commented Jun 23, 2018

test_interactive_backend[qt5agg] seems to be throwing a fit. Also there is a PEP8 error in gridspec.py, though I don't see that this PR added that... Mysterious!

@timhoffm
Copy link
Member Author

@jklymak Since the string is quite short, it's ok to put it in __repr__.

@dstansby dstansby added this to the v3.0 milestone Jun 25, 2018
Copy link
Contributor

@anntzer anntzer left a comment

Choose a reason for hiding this comment

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

Perhaps also include height_ratios and width_ratios in the repr (if not None)? This way eval-ing the repr would actually yield an equivalent GridSpec.

Marking as change request as otherwise eval-ing can yield a different GridSpec, but feel free to dismiss if you really don't want to implement it...

@timhoffm
Copy link
Member Author

timhoffm commented Jun 26, 2018

@anntzer I was just too lazy 😄 . But you are right, if we make the repr an eval-able expression, it should be complete. Done.

@anntzer
Copy link
Contributor

anntzer commented Jun 26, 2018

anyone can merge after CI

@timhoffm timhoffm merged commit 9d5fc37 into matplotlib:master Jun 27, 2018
@timhoffm timhoffm deleted the gridpsec-repr branch June 27, 2018 22:08
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