FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-143535: Document dispatch behavior of singledispatchmethod by priyanshu2282-cyber · Pull Request #143592 · python/cpython · GitHub

Repository navigation

gh-143535: Document dispatch behavior of singledispatchmethod - #143592

Closed
priyanshu2282-cyber wants to merge 8 commits into
python:mainfrom
priyanshu2282-cyber:doc-singledispatchmethod-dispatch
Closed

priyanshu2282-cyber wants to merge 8 commits into
python:mainfrom
priyanshu2282-cyber:doc-singledispatchmethod-dispatch

Conversation

priyanshu2282-cyber commented Jan 9, 2026 •
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

The PR clarifies the behavior of singledispatchmethod in the documentation. It always dispatches the first argument during call, regardless of whether the method is bound or unbound, as a result xf(a)!=c.f(x,a). The behavior is intentional and required to support correct dispatch for staticmethod and classmethod.


📚 Documentation preview 📚: https://cpython-previews--143592.org.readthedocs.build/

python-cla-bot Bot commented Jan 9, 2026 •
edited
Loading

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

Comment thread Doc/library/functools.rst Outdated

bedevere-app Bot commented Jan 9, 2026

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again.

bedevere-app Bot commented Jan 9, 2026

Copy link
Copy Markdown

Thanks for making the requested changes!

@picnixz: please review the changes made to this pull request.

bedevere-app Bot requested a review from picnixz January 9, 2026 11:12
Comment thread Doc/library/functools.rst Outdated
priyanshu2282-cyber and others added 2 commits January 12, 2026 20:41
Co-authored-by: Bartosz Sławecki <bartosz@ilikepython.com>
Comment thread Doc/library/functools.rst Outdated
Comment on lines +721 to +724
For every ``singledispatchmethod`` method defined in a class, the value
dispatched on by that method is *always* the first argument passed for the call.
Therefore, dispatching to regular methods can only be sensibly performed by
calling such a method from instances of the class, and not from the class object.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Align your paragraph with the other paragraphs, that is, use the correct indentation. You're 1 space off.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Got it, Aligned!

bedevere-app Bot commented Jan 13, 2026

Copy link
Copy Markdown

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

Comment thread Doc/library/functools.rst Outdated
The same pattern can be used for other similar decorators:
:deco:`staticmethod`, :deco:`~abc.abstractmethod`, and others.

For every ``singledispatchmethod`` method defined in a class, the value

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You don't define a singledispatchmethod, you decorate one with this decorator. See the other paragraphs.

johnslavik Jan 13, 2026 •
edited
Loading

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

You don't define a singledispatchmethod

It doesn't say singledispatchmethod defined in a class, but singledispatchmethod method defined in a class.

However, I agree that the current wording can be better. If it was good, you wouldn't have raised the thread.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for your clarification, I have used the decorators as suggested, and updated the PR.

Copy link
Copy Markdown
Contributor Author

I have made the requested changes; please review again

bedevere-app Bot commented Jan 13, 2026

Copy link
Copy Markdown

Thanks for making the requested changes!

@picnixz: please review the changes made to this pull request.

bedevere-app Bot requested a review from picnixz January 13, 2026 18:13

picnixz commented Jan 13, 2026

Copy link
Copy Markdown
Member

You did not address all my comments. I am going offline but I really need you to address everything before requesting a review as this makes me lose my time.

priyanshu2282-cyber commented Jan 14, 2026 •
edited
Loading

Copy link
Copy Markdown
Contributor Author

Sorry for the back-and-forth. I’ve addressed all the review comments and also I have made the requested changes; please review again @picnixz

Copy link
Copy Markdown
Contributor Author

Hi @johnslavik, just checking in on this PR in case it slipped through. No rush at all, would appreciate your feedback when you have time. Thanks!

jaraco commented Feb 15, 2026

Copy link
Copy Markdown
Member

#144615 demonstrates that this behavior can be fairly easily accounted for. I'd prefer to elevate the capability rather than document the deficiency.

picnixz commented Feb 16, 2026

Copy link
Copy Markdown
Member

Agreed. Let us close this one then.

picnixz closed this Feb 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

4 participants


Back | FazBrowse Home | New Git URL