Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork7.9k
Make function signatures more explicit#10830
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
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.
LGTM pending CI
lib/matplotlib/axes/_axes.py Outdated
@@ -471,8 +471,8 @@ def text(self, x, y, s, fontdict=None, withdash=False, **kwargs): | |||
return t | |||
@docstring.dedent_interpd | |||
def annotate(self, *args, **kwargs): | |||
a = mtext.Annotation(*args, **kwargs) | |||
def annotate(self, text, xy, **kwargs): |
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.
Looks like annotate can sometimes take a second xy (for the other end of the arrow)
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.
Whoops. Yeah, the explicit kwargs of the inner method could be passed as positional.
163e48f
to7433f66
CompareThere 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.
Good.
PR Summary
As proposed in#9912 (comment), more explicit signatures help to understand how a function works.
This PR does only contain simple cases, in which the arguments are handed down to another function (e.g. pyplot function -> Figure method). Up to now, the outer function was often
*args, **kwargs
. I explicitly copy parts (or the whole) of the inner function signature to the outer function. The PR is limited to cases, that do not change possible calls (e.g. certain combination of args and kwargs).