-
Notifications
You must be signed in to change notification settings - Fork 613
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
List.__eq__ doesn't raise on non-Sized
Summary: In general, comparison operators shouldn't raise on a type mismatch; instead `__eq__` should return `False` and `__ne__` should return `True`. The behavior for `__lt__` etc. is ambiguous, so leaving that unchanged. This diff adds a `Sized` check to return `False` early in equality check. It also splits the `list_compare` method into `list_eq` and `list_lt` to make these easier to understand and improve performance (e.g., less branching inside `for` loop). V2: had # / buildall Reviewed By: yoney Differential Revision: D64998005 fbshipit-source-id: d99e45784b4e16d2b45e434ef30e89a167ece778
- Loading branch information
1 parent
8759ff1
commit fb180f0
Showing
2 changed files
with
39 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters