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
{{ message }}
Repository navigation
Function returning NotImplementedType cannot return NotImplemented if strict=True #18914
Ohh. NotImplemented is really underspecified in typing context. For all comparison methods we silently assume that it can be returned from bool-returning methods like __lt__. I agree that NotImplemented shouldn't be treated as Any everywhere, but this change will be rather difficult to release - everything from stdlib to third-party stubs relies on it.
However, it's certainly reasonable to make NotImplemented a better exception - perhaps by tweaking its TypeOfAny to stop it from showing in the reports.
Activity
sterliakov commentedon Apr 12, 2025
Ohh.
NotImplementedis really underspecified in typing context. For all comparison methods we silently assume that it can be returned from bool-returning methods like__lt__. I agree thatNotImplementedshouldn't be treated asAnyeverywhere, but this change will be rather difficult to release - everything from stdlib to third-party stubs relies on it.However, it's certainly reasonable to make
NotImplementeda better exception - perhaps by tweaking itsTypeOfAnyto stop it from showing in the reports.