[Python-Dev] Adding Type[C] to PEP 484

Stephen J. Turnbull stephen at xemacs.org
Sat May 21 03:49:11 EDT 2016


Sven R. Kunze writes:

 > Type[A, B] reminds me of isinstance(obj, (A, B)).

Sure, but Guido already invoked EIBTI.

For one (obscure) alternative, Type[A, B] reminded me of Fun(A,B) (the
functors from category A to category B), and in Python I would tend to
map that to a function type (taking argument from A, returning value
from B).  Another (probably more plausible to Pythonistas) would be a
type that *mixes* A and B, ie, one might be reminded of

    class C(A, B):
        pass

    isinstance(obj, C)

or even (continuing the example)

    class E(B, A, D):        # Order of A, B irrelevant!  Yikes!
        pass

    isinstance(obj, (C, E))

Regards,


More information about the Python-Dev mailing list