singledispatch and singledispatchmethod don't analyze and adapt argument semantics to the registered callable type, which makes them very nice and simple.
_singledispatchmethod_get always dispatches on args[0] regardless of whether it's bound or unbound, and if it didn't, that would break descriptor support; this facet is crucial for staticmethod (and classmethod) dispatches to work:
changed the title [-]`singledispatchmethod` dispatches on the `self` argument what invoked from class level[/-][+]`singledispatchmethod` dispatches on the `self` argument when invoked from class level[/+]on Jan 8, 2026
changed the title [-]`singledispatchmethod` dispatches on the `self` argument when invoked from class level[/-][+]Document that `singledispatchmethod` dispatches on the `self` argument when invoked from class level[/+]on Jan 9, 2026
I have prepared a doc fix and raising a PR in which I have documented the behaviour that singledispatchmethod always dispatches first argument during call, which fails the regular behaviour of x.f(a)=c.f(a).
changed the title [-]Document that `singledispatchmethod` dispatches on the `self` argument when invoked from class level[/-][+]`singledispatchmethod` dispatches on bound argument when invoked from class level[/+]on Feb 8, 2026
changed the title [-]`singledispatchmethod` dispatches on bound argument when invoked from class level[/-][+]`singledispatchmethod` dispatches on first argument to instance-bindable method called from class level[/+]on Feb 8, 2026
Activity
pythongh-143535: Document dispatch behavior of singledispatchmethod
priyanshu2282-cyber commented on Jan 9, 2026
I have prepared a doc fix and raising a PR in which I have documented the behaviour that singledispatchmethod always dispatches first argument during call, which fails the regular behaviour of x.f(a)=c.f(a).
pythongh-143535: Move singledispatchmethod note outside example block
pythongh-143535: Clarify dispatch semantics of singledispatchmethod
pythongh-143535: Fix indentation in singledispatchmethod docs
johnslavik commented on Feb 8, 2026
I was wrong. This can be fixed, 100% low-risk.
gh-143535: Dispatch on the second argument if generic method is insta…
ambv commented on Feb 24, 2026
Reclassifying as feature for backward compat safety. Fixed by #144615.
pythongh-143535: Dispatch on the second argument if generic method is…
pythongh-143535: Dispatch on the second argument if generic method is…