How do you implement custom comparison operators? #26
Answered
by
lukasmiller3
lukasmiller1
asked this question in
Q&A
-
|
How do you implement custom comparison operators? |
Beta Was this translation helpful? Give feedback.
Answered by
lukasmiller3
Jan 22, 2026
Replies: 1 comment
-
|
A:Implement lt, le, eq, ne, gt, ge for comparison operators (<, <=, ==, !=, >, >=). Alternatively, use |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
lukasmiller1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A:Implement lt, le, eq, ne, gt, ge for comparison operators (<, <=, ==, !=, >, >=). Alternatively, use
@functools.total_orderingwith just eq and one comparison method to generate the rest automatically.