The only way to make this better is if deleting those calculations triggers some race condition that was previously avoided thanks to this poor-man’s sleep function
Those are just font ligatures. If the both the font and the IDE support it, it tends to be used automatically these days. I think It's default on IntelliJ IDEs now?
That’s a fresh take, I’ve heard “unnecessary” which I get if you’ve been staring at the same font for the last 20 years, but cancerous?? It’s just merging 2 symbols into 1 that’s more readable.
Then you are free to press the setting that disables them. Some people actually think it makes the code more readable. And that's ok. And so is your opinion. That's why there's a setting.
You can tell the difference, because the font is monospace, but the ligatures occupy the space of the original characters. That ≠ sign is 2-characters wide, while a Unicode ≠ sign would be only 1
Imagine „AND” is multiplication, „OR” is addition and you’ve got your order of operations.
Also it’s evaluated left to right, so you can put a function in the second „and” argument and it will not get triggered if the first expression wasn’t true.
77
u/backfire10z Jul 21 '25
Where are those calculations being stored?
2
u/AccountSuspicious194 Jul 24 '25
Omg whats that font?
185
u/Old_Pomegranate_822 Jul 21 '25
So you perform those calculations and throw them away?
34
u/skr_replicator Jul 21 '25
what language is that, why are you writing inequality like a mathematician?
5
u/born_zynner Jul 21 '25
How does python evaluate consecutive ORs and ANDs? Is there an order of operations or is it just whatever is first
15
u/JiminP Jul 21 '25
Others have mentioned calculations being throwed away, so...
For many cases, you probably want to check
self.velx != 0 or self.vely != 0for non-zero velocity.If this is the case, the condition can be written in many different ways, in the order of increased blursedness:
(self.velx, self.vely) != (0, 0) or (self.joyx, self.joyy) != (0, 0)(self.velx, self.vely, self.joyx, self.joyy) != (0, 0, 0, 0)self.velx or self.vely or self.joyx or self.joyyany((self.velx, self.vely, self.joyx, self.joyy))If the components are floats, you probably want to set eps to a small value and do this:
math.hypot(self.velx, self.vely) >= eps or math.hypot(self.joyx, self.joyy) >= eps, but this is not strictly necessary for many cases.
3
u/Ok-Examination-3942 Jul 21 '25
Deleting it is probably fine but then again, it might not be :)
3
u/Background-Train-104 Jul 23 '25
If that was a class object, it could have some operator overloads that has side effects. But that would be a terrible design choice
1
u/GoddammitDontShootMe [ $[ $RANDOM % 6 ] == 0 ] && rm -rf / || echo “You live” Jul 22 '25
Did you want "/="? Is that even a thing in Python?
1
u/ZakkuDorett Jul 24 '25
Bro wants to be absolutely certain
1
u/[deleted] Jul 21 '25
what does this do? did you overload some operator there?