[issue40978] Document that typing.SupportsXXX protocols are runtime checkable

ramalho report at bugs.python.org
Mon Jul 13 21:43:36 EDT 2020


ramalho <luciano at ramalho.org> added the comment:

After experimenting with theses protocols, I believe the user community is better served by leaving undocumented the fact that they are runtime checkable, because their runtime results are inconsistent with how Mypy handles them, producing both false positives and false negatives.

I've documented the problems (https://github.com/fluentpython/abc-protocol-labs/blob/master/protocol-issues.rst) and started two threads about them in the typing-sig mailing list:

[1] https://mail.python.org/archives/list/typing-sig@python.org/message/CSM3ZCWNRBO4RGGTSM664DD37JYOUVCO/ 
[2] https://mail.python.org/archives/list/typing-sig@python.org/message/FSV6WSFGWD4QZO6ECY3JADF7M2PW5FKK/

Thread [1] got a useful partial response from Guido. Open questions remain. Thread [2] got no response at all.

I will gladly reengage in those threads or in this issue if there is interest. As it stands, I believe the use of the @runtime_checkable feature on several of these protocols is unreliable and should not be promoted.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40978>
_______________________________________


More information about the Python-bugs-list mailing list