On Nov 29, 2020, at 3:46 AM, Guido van Rossum email@example.com wrote:
You could parenthesize the return value if you think it's not clear
Yeah I agree. Parenthesizing the return should be optional because if we require it, the callable arguments with parenthesized returns and the parenthesized return of the return itself would look too much.
Optional Return Parenthesis: ((int, str) -> int, (…) -> str) -> ((str) -> int) VS. Required Return Parenthesis: ((int, str) -> (int), (…) -> (str)) -> ((str) -> (int)) …. Consistent but too many parenthesis
Indeed. Shantanu did some quick counting and found that after 'Any' and the types covered by PEP 585, Callable is by far the most used: https://bugs.python.org/issue42102#msg381155 https://bugs.python.org/issue42102#msg381155
Nice survey. Can we do something with “Any" once we are at it? Maybe we use “?”. But that might confuse people and think it’s None mirroring PEP 645’s “type?”.