This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kj
Recipients BTaskaya, Zac Hatfield-Dodds, corona10, gvanrossum, kj, levkivskyi, serhiy.storchaka
Date 2020-11-19.10:54:54
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1605783295.17.0.0164113403434.issue42195@roundup.psfhosted.org>
In-reply-to
Content
I tried to implement Callable[[int, int], str] as ((int, int), str). However, it breaks much of typing's tests and requires recursion to account for the nested tuples, in both typing, and in the C implementation of GenericAlias.

I'd like to humbly propose a less breaking solution: express __args__ of Callable[[int, int], str] as (Tuple[int, int], str). Almost all the current code in the typing library already supports this. As for collections.abc.Callable, its __args__ simply needs to be expressed as (tuple[int, int], str). This is also an easy fix.

Semantically, this makes sense to me too. Both of the above changes will also still allow caching since Tuple[x] is hashable. This will allow us to fix this issue without depending on issue42102, or at least it can be a stop gap measure. If issue42102 has a resolution, the C implementation can just replace the Python one directly.
History
Date User Action Args
2020-11-19 10:54:55kjsetrecipients: + kj, gvanrossum, serhiy.storchaka, levkivskyi, corona10, Zac Hatfield-Dodds, BTaskaya
2020-11-19 10:54:55kjsetmessageid: <1605783295.17.0.0164113403434.issue42195@roundup.psfhosted.org>
2020-11-19 10:54:55kjlinkissue42195 messages
2020-11-19 10:54:54kjcreate