El vie, 15 oct 2021 a las 14:42, Abdulla Al Kathiri (<
alkathiri.abdu...@gmail.com>) escribió:

> I don’t understand why tuple structure is not supported already. It makes
> reading the function signature a breeze and very natural. You can also do
> it without parentheses which mimics the return of multiple objects often
> seen in functions(def func(*args: int) -> str, [int])
>
> I brought this up before and one issue is that it's hard to distinguish
between a tuple used as a type parameter and multiple type parameters:

GenericClass[(A, B)]  # parameterized by the type Tuple[A, B]
GenericClass[A, B]  # two type parameters

The ASTs for both of those are the same, so it would be difficult for mypy
to distinguish them.

I do agree that it would be nice to write types like ([str], [int]), but
there are some practical problems.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/BZBQFKZFBFE7VQZZ5FEMNYN3KJDZPNMF/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to