-
Notifications
You must be signed in to change notification settings - Fork 308
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
Implement __eq__
for AbstractParticle
#873
base: main
Are you sure you want to change the base?
Conversation
Codecov Report
@@ Coverage Diff @@
## master #873 +/- ##
==========================================
- Coverage 96.13% 96.11% -0.03%
==========================================
Files 60 60
Lines 5309 5277 -32
==========================================
- Hits 5104 5072 -32
Misses 205 205
Continue to review full report at Codecov.
|
This commit is a proof of concept and experiment for the mentioned issues. A few queries I had in mind:
Thank you! |
Well... for a
Ideally, yeah! That seems like a good idea. |
I agree. Best to avoid checking for equivalence between particles and string when the particle has a charge and a mass.
This might be tricky to generalise though. For Thank you! |
I'm wondering a bit more about how we should treat With all that said, I still think it's reasonable to define |
This is interesting and raises a question. At the moment, the 3 classes inheriting from
This works too, however, may require redesigning and potential deprecation of some features from |
My opinion, defining
With this approach, I don't think the flavor of For the class Particle(AbstractParticle):
def __eq__(self, other):
super().__eq__(other)
# add additional comparisons
# basically a deep comparison of the self._attributes dictionary I believe this is the approach you're already doing. So, from my perspective, there's two points to address...
|
docstrings.
Closes #806
May close #848
Implements
__eq__
intoAbstractParticle
class, allowing comparisons ofCustomParticle
andDimensionlessParticle
using==
operator.