GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — `singledispatchmethod` dispatches on first argument to instance-bindable method called from class level · Issue #143535 · python/cpython Closed Labels 3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement DescriptionIn this usage of from functools import singledispatchmethod class C: @singledispatchmethod def d(self, x): return "base!" @d.register(int) def _(self, x): return "int!" print(C.d(C(), 1)) This is what I expected in the output: But instead this was printed out:
from functools import singledispatchmethod class C: @singledispatchmethod @staticmethod def d(x): return "base!" @d.register(int) @staticmethod def s(x): return "int!" print(C.d(1)) # int! Our tests rely on this and possibly millions of projects rely on this. I think we could document this explicitly (and backport to 3.13 and 3.14). Found this while working on GH-143465. CPython versions tested on:CPython main branch Operating systems tested on:Linux Linked PRsActivity
MetadataMetadataAssigneesLabels3.13only security fixesonly security fixes3.14bugs and security fixesbugs and security fixesstdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancementA feature request or enhancement Projects
MilestoneRelationshipsDevelopmentIssue actions |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |