From 591d476fca082e3fa92061aca514a53e5cb8ce06 Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Sat, 4 Apr 2020 21:51:20 +0800 Subject: [PATCH] Note on why we don't implement equality --- src/pip/_internal/resolution/resolvelib/candidates.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pip/_internal/resolution/resolvelib/candidates.py b/src/pip/_internal/resolution/resolvelib/candidates.py index a3397a271..7bc4815b0 100644 --- a/src/pip/_internal/resolution/resolvelib/candidates.py +++ b/src/pip/_internal/resolution/resolvelib/candidates.py @@ -420,6 +420,10 @@ class RequiresPythonCandidate(Candidate): version_info = sys.version_info[:3] self._version = Version(".".join(str(c) for c in version_info)) + # We don't need to implement __eq__() and __ne__() since there is always + # only one RequiresPythonCandidate in a resolution, i.e. the host Python. + # The built-in object.__eq__() and object.__ne__() do exactly what we want. + @property def name(self): # type: () -> str