[Python-ideas] Using rightarrow "->" for typing annotation of functions

Stephan Hoyer shoyer at gmail.com
Fri Apr 26 00:20:10 EDT 2019


On Thu, Apr 25, 2019 at 1:51 PM Ivan Levkivskyi <levkivskyi at gmail.com>
wrote:

> TBH, I don't think it is so bad that it requires a new syntax. But I am
> not strongly against it either. What I would like to add here is that if we
> will go with the replacement:
>
> Callable[[X, Y], Z] becomes (X, Y) -> Z
>
> then we should also go with
>
> Union[X, Y] becomes X | Y
> Tuple[X, Y] becomes (X, Y)
>

This may not be workable, because A[X, Y] and A[(X, Y)] have identical
semantics in Python. So Tuple[(X, Y)] could either mean Tuple[X, Y] or
Tuple[Tuple[X, Y]].
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190425/132dfd74/attachment.html>


More information about the Python-ideas mailing list