forked from matplotlib/matplotlib
-
Notifications
You must be signed in to change notification settings - Fork 1
Layout engine #2
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
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
123e9b3
MNT: move _adjust_compatible and _colorbar_gridspec to class level
tacaswell 381974e
MNT: have all the __init__ methods pass kwargs through
tacaswell 351e82d
MNT: have get return a copy of the parameters
tacaswell d050de0
DOC: re-format the docstring
tacaswell 9edefd2
TST: tweak strings to search for in warnings
tacaswell File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just for my education, why are these better defined here than in the init?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is a couple of marginal things for me.
Defining them in
__init__
sub-classes will either have to be sure to call__super__()
(which they do have to here for other reasons so this is a bit of a wash here) or remember to define these values directly. By putting them on the class object you have taken a bit of a burden / defused a trap for the down stream user. In the case of a user-implemented subclass that does not want to make itself configurable at init time (because it has no configuration or just because), then the do not even have to define an__init__
with these values as class level attributes.Another advantage of this is because these really are class-constants (at least for these two) in the sense that these should never change at run time. Putting them here indicates that and makes it easy to, when skimming the code, see these right away as different "class state things" not "instance state things". It is a small thing, but it gives a hint to someone reading this to implement their own.
By making these default to
None
(and checking it in the properties!) you force a down-stream implementer to think about this once to make a choice.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, thanks for the insight!