Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

there is no use-case of comparing a Literal with None (I think) #1155

Open
wants to merge 2 commits into
base: 8.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions rdflib/term.py
Original file line number Diff line number Diff line change
Expand Up @@ -840,8 +840,6 @@ def __gt__(self, other):
>>> Literal("a", lang="en") > Literal("a", lang="fr")
False
"""
if other is None:
return True # Everything is greater than None
if isinstance(other, Literal):

if (
Expand Down Expand Up @@ -900,8 +898,6 @@ def __gt__(self, other):
return NotImplemented # we can only compare to nodes

def __lt__(self, other):
if other is None:
return False # Nothing is less than None
if isinstance(other, Literal):
try:
return not self.__gt__(other) and not self.eq(other)
Expand Down Expand Up @@ -1041,7 +1037,8 @@ def __eq__(self, other):
"""
if self is other:
return True
if other is None:

if other is None:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats going on with the indentation here? This line is offset by two spaces?

return False
# Directly accessing the member is faster than the property.
if isinstance(other, Literal):
Expand Down