The formal term for that is intersection types. There is a long-standing
thread about that at https://github.com/python/typing/issues/213; there are
some uses but the feature would greatly complicate the type system, so it's
not clear that it's worth adding.

At this point, what Intersection needs is someone to champion the proposal
and write a PEP.

El lun, 24 abr 2023 a las 6:21, Mathew Elman (<[email protected]>)
escribió:

> Rather than changing Protocols and affecting lots of users, it seems like
> was you really want is a generic class that is the "and" to Union's "or"?
> e.g.
>
> def foo(thing: All[Thread, SupportsStop]):
>     ...
>
> which seems reasonable. If that appeals to you, then you probably want to
> raise that on the typing thread?
> _______________________________________________
> Python-ideas mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/python-ideas.python.org/
> Message archived at
> https://mail.python.org/archives/list/[email protected]/message/JV3OYN5LXNMHBOT5RGEFHXSQYFKNB2EB/
> Code of Conduct: http://python.org/psf/codeofconduct/
>
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/[email protected]/message/IRDVK4B6K3QPIZAZ35YKVCFFAYA72WJM/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to