You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is Python code that takes advantage of this to override == to return something other than a bool (e.g., numpy arrays). Type checking code like that against the typeshed type stubs leads to incompatible overrides (e.g., numpy array is not a subtype of bool).
Should these methods be annotated as returning object?
The text was updated successfully, but these errors were encountered:
In
builtins.pyi
there is:But I think that both of these methods should return
object
. I believe that they eventually get called in CPython bytp_richcompare
which doesn't necessarily returnbool
(https://github.com/python/cpython/blob/1626bf4ac7aef1244e6f886e63a31f7ed65fbd10/Objects/object.c#L655).There is Python code that takes advantage of this to override
==
to return something other than a bool (e.g., numpy arrays). Type checking code like that against the typeshed type stubs leads to incompatible overrides (e.g., numpy array is not a subtype ofbool
).Should these methods be annotated as returning
object
?The text was updated successfully, but these errors were encountered: