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 gvanrossum
Recipients BTaskaya, gvanrossum, hauntsaninja, kj, levkivskyi, serhiy.storchaka
Date 2020-11-23.05:21:48
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1606108908.82.0.864022330546.issue42102@roundup.psfhosted.org>
In-reply-to
Content
Hm. Shantanu's list shows that the next thing we should make usable without importing typing is Any. (I haven't any idea how to do that other than just making it a builtin.) But after that we should definitely tackle Callable, and the obvious way to do it is to make callable indexable. But does that mean it has to be a type? I don't think so -- it just has to be an object whose class defines both __call__ and __getitem__. Pseudo code:

class callable:
    def __call__(self, thing):
        return hasattr(thing, "__call__")
    def __getitem__(self, index):
        # returns a types.GenericAlias instance
        # (or a subclass thereof)

I honestly don't think that we should support isinstance(x, callable) even if some people think that that should work.

In any case, we should first answer the questions that are still open for issue 42195 -- what should __args__ for [cC]allable[[int, int], str] be? (int, int, str) or ((int, int), str) or ([int, int], str) or (Tuple[int, int], str) are all still on the table. Please refer to that issue.
History
Date User Action Args
2020-11-23 05:21:48gvanrossumsetrecipients: + gvanrossum, serhiy.storchaka, levkivskyi, BTaskaya, hauntsaninja, kj
2020-11-23 05:21:48gvanrossumsetmessageid: <1606108908.82.0.864022330546.issue42102@roundup.psfhosted.org>
2020-11-23 05:21:48gvanrossumlinkissue42102 messages
2020-11-23 05:21:48gvanrossumcreate