From fcdd4c2abe8b4bef45383ac097d399d7f91b5f88 Mon Sep 17 00:00:00 2001 From: rlskoeser Date: Fri, 27 Oct 2023 17:00:31 -0400 Subject: [PATCH] Add a note about not implemented exceptions for unknown comparisons --- src/undate/undate.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/undate/undate.py b/src/undate/undate.py index 3e3d514..db356f5 100644 --- a/src/undate/undate.py +++ b/src/undate/undate.py @@ -225,6 +225,12 @@ def __lt__(self, other: Union["Undate", datetime.date]) -> bool: raise NotImplementedError( "Can't compare when one date falls within the other" ) + # NOTE: unsupported comparisons are supposed to return NotImplemented + # However, doing that in this case results in a confusing TypeError! + # TypeError: '<' not supported between instances of 'Undate' and 'Undate' + # How to handle when the comparison is ambiguous / indeterminate? + # we may need a tribool / ternary type (true, false, unknown), + # but not sure what python builtin methods will do with it (unknown = false?) # for any other case (i.e., self == other), return false return False