Answer the question
In order to leave comments, you need to log in
Exclude in the condition or assign again each time?
Option 1
if (abs(self.speedx) < 0.4) and self.speedx != 0:
self.speedx = 0
Option 2
if abs(self.speedx) < 0.4:
self.speedx = 0
Which option is better and why? Or is there no fundamental difference?
Answer the question
In order to leave comments, you need to log in
Savings on matches ...
But if you want, then look at what is more likely.
If in your data the situation speedx == 0 is much more common than getting into the range 0+ .. 0.4 - then option 1 probably makes some sense ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question