This just reminded me of something I forgot the name of, that not ((not a) or (not b))
is equivalent to a and b
, and the same with and
and or
swapped.
More usually written as (not a) or (not b) = not (a and b)
.
Your way is right, too, of course, but in practice you're unlikely to stumble upon not ((not a) or (not b))
, whereas it's fairly common to need to compute not (a and b)
.
Turns out I had exactly that:
if (not self.world.is_dev_mode and
not is_menu_click):
to
if not (self.world.is_dev_mode or
is_menu_click):