From 11c4dd9249e0cd1921c7978c59d14e5470184507 Mon Sep 17 00:00:00 2001 From: Eduardo Rodrigues Date: Fri, 6 Sep 2024 17:51:11 +0200 Subject: [PATCH] Apply suggestions from code review --- src/particle/particle/particle.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/particle/particle/particle.py b/src/particle/particle/particle.py index 4864cd33..6a740cfa 100644 --- a/src/particle/particle/particle.py +++ b/src/particle/particle/particle.py @@ -50,8 +50,8 @@ class InvalidParticle(RuntimeError): pass -# the neutron, proton and their anti-particles have two possible pdgid representations -# a) the bag of quarks b) the nucleus +# The proton and the neutron (and their anti-particles) have two possible PDG ID representations, +# a) a particle ("bag of quarks") or b) a nucleus. _NON_UNIQUE_PDGIDS = { 2112: 1000000010, 2212: 1000010010, @@ -626,6 +626,12 @@ def __lt__(self, other: Particle | int) -> bool: return int(self.pdgid) < other def __eq__(self, other: object) -> bool: + """ + Note + ---- + Ensure the comparison also works for the special cases of the proton and the neutron, + which have two PDG ID representations as particles or nuclei.""" + """ if isinstance(other, Particle): other = other.pdgid