For the following sample:
def fuctionName(int, bool):
if int in range(...):
if bool == True:
return False
else:
r
The accepted answer here is the most correct for the given scenario.
It made me wonder though about simply inverting a boolean value in general. It turns out the accepted solution here works as one liner, and there's another one-liner that works as well. Assuming you have a variable "n" that you know is a boolean, the easiest ways to invert it are:
n = n is False
which was my original solution, and then the accepted answer from this question:
n = not n
The latter IS more clear, but I wondered about performance and hucked it through timeit - and it turns out at n = not n is also the FASTER way to invert the boolean value.