Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged

Conversation

timhoffm
Copy link
Member

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).

Copy link
Member

@jklymakjklymak left a comment

Choose a reason for hiding this comment

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

LGTM pending CI

@@ -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):
Copy link
Member

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)

Copy link
MemberAuthor

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.

@timhoffmtimhoffmforce-pushed theexplicit-args-signature branch from163e48f to7433f66CompareMarch 18, 2018 18:54
Copy link
Member

@efiringefiring left a comment

Choose a reason for hiding this comment

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

Good.

@efiringefiring merged commitf9f7d52 intomatplotlib:masterMar 18, 2018
@tacaswelltacaswell added this to thev3.0 milestoneMar 18, 2018
@timhoffmtimhoffm deleted the explicit-args-signature branchMarch 18, 2018 22:43
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@jklymakjklymakjklymak approved these changes

@efiringefiringefiring approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
v3.0.0
Development

Successfully merging this pull request may close these issues.

4 participants
@timhoffm@efiring@jklymak@tacaswell

[8]ページ先頭

©2009-2025 Movatter.jp