[issue36555] PEP484 @overload vs. str/bytes

2019-04-10 Thread Guido van Rossum
Guido van Rossum added the comment: > 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) ->

[issue36555] PEP484 @overload vs. str/bytes

2019-04-08 Thread Ivan Levkivskyi
Ivan Levkivskyi added the comment: Mypy already takes first overload for ambiguous arguments. This example is however genuinely unsafe from the static typing point of view. Please read the docs https://mypy.readthedocs.io/en/latest/more_types.html#type-checking-the-variants --

[issue36555] PEP484 @overload vs. str/bytes

2019-04-08 Thread Karthikeyan Singaravelan
Change by Karthikeyan Singaravelan : -- nosy: +gvanrossum, levkivskyi ___ Python tracker ___ ___ Python-bugs-list mailing list

[issue36555] PEP484 @overload vs. str/bytes

2019-04-08 Thread Crusader Ky
New submission from Crusader Ky : An exceedingly common pattern in many Python libraries is for a function to accept either a string or a list of strings, and change the function output accordingly. This however does not play nice with @typing.overload, as a str variable is also an