Message 339889 - Python tracker

Message339889

Author gvanrossum
Recipients crusaderky, gvanrossum, levkivskyi
Date 2019-04-10.20:27:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1554928079.91.0.539249651204.issue36555@roundup.psfhosted.org>
In-reply-to
Content
> Mypy already takes first overload for ambiguous arguments.

This is true, but it requires that the return types match (covariantly, IIUC) for the overlapping types. So you can have

@overload
def foo(x: int) -> int: ...
@overload
def foo(x: float) -> float: ...

But you can't have

@overload
def foo(x: int) -> str: ...
@overload
def foo(x: float) -> float: ...

(and the docs explain why -- search for "unsafe_func").
History
Date User Action Args
2019-04-10 20:27:59gvanrossumsetrecipients: + gvanrossum, levkivskyi, crusaderky
2019-04-10 20:27:59gvanrossumsetmessageid: <1554928079.91.0.539249651204.issue36555@roundup.psfhosted.org>
2019-04-10 20:27:59gvanrossumlinkissue36555 messages
2019-04-10 20:27:59gvanrossumcreate