Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Abstract base class for Normalize #30178

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

trygvrad
Copy link
Contributor

This PR is an alternative to #30149
It is created so that we can contrast full implementations of a protocol vs an abstract base class in light of the comment here #30149 (comment)
For context on why this is required, see the comment on the MultiNorm PR #29876 (comment)

@tacaswell
Copy link
Member

After discussion on this weeks call I think we should go with the ABC flavor. Given:

  • from a technical point of view both do the job and there is no clear technical winner so it is subjective call
  • @timhoffm prefers ABCs
  • some of our core developers learned Protocols exist due to this discussion
  • ABCs have been around a lot longer than Protocols
  • we don't have any Protocols currently in the code base

If we are going to bring in a new language feature we should do that when it brings in a clear benefit so we should stick with ABC.

@tacaswell
Copy link
Member

The docs failure is real, The new class needs to be manually added to the rst.

Copy link
Member

@tacaswell tacaswell left a comment

Choose a reason for hiding this comment

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

modulo fixing the docs build.

@QuLogic
Copy link
Member

QuLogic commented Jun 19, 2025

If I'm not mistaken, once you put the base class into Sphinx, you can replace the duplicate docstrings in the no-longer-base class with # docstring inherited.

@timhoffm
Copy link
Member

The doc build failure looks a bit cryptic, but I think putting Norm here will solve it
https://github.com/matplotlib/matplotlib/blob/main/doc/api/colors_api.rst#color-norms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants