We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 717ef40 commit 14e8d7fCopy full SHA for 14e8d7f
rdflib/term.py
@@ -1107,9 +1107,15 @@ def __gt__(self, other: Any) -> bool:
1107
if other is None:
1108
return True # Everything is greater than None
1109
if isinstance(other, Literal):
1110
+ # Fast path for comapring numeric literals
1111
+ # that are not ill-typed and don't have a None value
1112
if (
- self.datatype in _NUMERIC_LITERAL_TYPES
- and other.datatype in _NUMERIC_LITERAL_TYPES
1113
+ (
1114
+ self.datatype in _NUMERIC_LITERAL_TYPES
1115
+ and other.datatype in _NUMERIC_LITERAL_TYPES
1116
+ )
1117
+ and ((not self.ill_typed) and (not other.ill_typed))
1118
+ and (self.value is not None and other.value is not None)
1119
):
1120
return self.value > other.value
1121
0 commit comments