This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Dutcho
Recipients Dutcho, FFY00, bim_bam
Date 2020-05-04.20:00:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1588622454.64.0.434626130273.issue40464@roundup.psfhosted.org>
In-reply-to
Content
I'm afraid my "even return" was interpreted in https://github.com/python/cpython/pull/19871 as "only return", while as stated "any annotation" suffices. To rephrase:
If the *first* parameter of the registered function isn't annotated, any non-first annotation suffices for registering, but will not dispatch correctly.
Example:
    ```
    >>> @functools.singledispatch
    ... def func(arg, x):...
    >>> @func.register
    ... def _int(arg, x:int):...
    >>> @func.register
    ... def _str(arg, x:str):...
```
No errors happen, although parameter `x` is annotated, not the first parameter `arg`. So `func()` will dispatch on the type of `arg` according to the annotation of `x`.
So I'm afraid the PR solves the specific "return" example case, but not the flagged general issue.
History
Date User Action Args
2020-05-04 20:00:54Dutchosetrecipients: + Dutcho, FFY00, bim_bam
2020-05-04 20:00:54Dutchosetmessageid: <1588622454.64.0.434626130273.issue40464@roundup.psfhosted.org>
2020-05-04 20:00:54Dutcholinkissue40464 messages
2020-05-04 20:00:54Dutchocreate