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

Do not check value of parameters from rcParam (and check rcParam befo…#26167

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

Open
oscargus wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromoscargus:checkrcparam

Conversation

oscargus
Copy link
Member

@oscargusoscargus commentedJun 22, 2023
edited
Loading

…re using them)

Inspired by some changes in#26164, but separated as they are not directly connected to that (some that could have been here might have gone in there though...).

If we get the rcParam (and that is checked) or set an argument to a valid value, it is not required to check withcheck_in_list.

Some rcParams were not checked when loaded, only when used.

Finally, small methods where the likely thing is that the correct parameter is passed and there are if-claused anyway, are checked at the end rather than the beginning.

PR summary

PR checklist

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.

Just one question.

Comment on lines 741 to +744
if style is None:
style = mpl.rcParams['font.style']
_api.check_in_list(['normal', 'italic', 'oblique'], style=style)
else:
_api.check_in_list(['normal', 'italic', 'oblique'], style=style)
Copy link
Member

@timhoffmtimhoffmJun 22, 2023
edited
Loading

Choose a reason for hiding this comment

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

I'm not a fan of this kind of change. The code get's longer, harder to follow and more prone to errors.

Double checking the rcParam value here does not hurt. The only disadvantage are 300ns performance loss (which I claim to be negigible in any real-world application). But since the rcParam validation is an independent concept, we don't have a guarantee that they are synchronous. Such differences could be an oversight. But I can also imagine cases where rcParams are used in multiple places and have a slightly broader acceptance range than what a specific function supports.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

The thing is that those 300 ns are multiplied with a huge number in many situations.

Copy link
Member

Choose a reason for hiding this comment

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

What is huge? If huge * 300ns > 2% of the total plot time, we may start to consider, otherwise, the benefit is negligible.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@timhoffmtimhoffmtimhoffm left review comments

@efiringefiringefiring requested changes

Requested changes must be addressed to merge this pull request.

Assignees
No one assigned
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@oscargus@efiring@timhoffm

[8]ページ先頭

©2009-2025 Movatter.jp