Guido van Rossum <gu...@python.org> added the comment:

> The documentation for `typing.overload` says in a non-stub file the last 
> definition shouldn't be typed.

Incorrect. It doesn't say it shouldn't be *typed*, it says it shouldn't be 
*decorated with @overload*, which is a different thing.

The example is correct, since no annotation is the same as annotating with 
`Any`.

But with `mypy --strict`, no annotation causes an error, so if you are using 
that, you have to add *some* annotation (e.g. `Any`).

In your final example, the overloads are not redundant, since only the 
overloads tell the type checker that the output type corresponds to the input 
type.

For more information, please see Gitter (linked from the typing home page).

----------
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42169>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to