Simplify SubplotParams.update().#15200
Conversation
by moving initialization, well, to `__init__`. Also improve the class docstring.
|
I wrote this as a consequence of reviewing #11086, indeed. This PR doesn't change any of the current behavior, though. |
| val = rcParams[key] | ||
|
|
||
| setattr(self, s, val) | ||
| if left is not None: |
There was a problem hiding this comment.
why don't you just move the assignment above the check so the check doesn't have to be so complicated? You will error out anyway is the check says to
There was a pr 8000 oblem hiding this comment.
Because the subplotparams instance would have been modified at that point, and would be left in an inconsistent state (e.g. if someone catches the exception -- they'll still be left with an unusable subplotparams).
There was a problem hiding this comment.
... but they passed in unusable subplotparams. Are you saying they should have the defaults even if they passed in incorrect ones?
There was a problem hiding this comment.
No, if someone passes unusable subplotparams we should immediately error out without modifying the subplotparams instance, so it'll stay in a usable state.
by moving initialization, well, to
__init__.Also improve the class docstring.
PR Summary
PR Checklist