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, hauntsaninja, kj, levkivskyi, serhiy.storchaka
Date 2020-12-01.02:24:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606789497.34.0.639103249814.issue42195@roundup.psfhosted.org>
In-reply-to
Content
FWIW, current code for extracting args type and return type from Callable seems to be something like this (at least from the typing module):

arg_types = __args__[:-1]
return_type = __args__[-1]

Once ParamSpec is added in, library authors would need to check specifically for that in arg_types and return_types. Other than that, I don't have enough expertise or experience to say what will/won't break. 

IMO a flat tuple is ok for now: AFAIK (and I might be completely wrong here), most runtime type checking libraries I've used don't validate the arguments passed in because being too strict may interfere with keyword arguments. (Eg. Callable in Pydantic https://pydantic-docs.helpmanual.io/usage/types/#callable). So the slightly more inconvenient way of reading Callable's __args__ seems to be an acceptable tradeoff for backwards compatibility and simplicity.
History
Date User Action Args
2020-12-01 02:24:57kjsetrecipients: + kj, gvanrossum, serhiy.storchaka, levkivskyi, corona10, Zac Hatfield-Dodds, BTaskaya, hauntsaninja
2020-12-01 02:24:57kjsetmessageid: <1606789497.34.0.639103249814.issue42195@roundup.psfhosted.org>
2020-12-01 02:24:57kjlinkissue42195 messages
2020-12-01 02:24:55kjcreate