Ken Jin <kenjin4...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42195>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to