The previous dev has left a really strange not x is None
yoda condition in the code:
>>> x = None
>>> not x is None
False
>>> x = 1
>>> not x is None
True
After some testing, I seem the same output as x is not None
.
>>> x = None
>>> not x is None
False
>>> x is not None
False
>>> x = 1
>>> not x is None
True
>>> x is not None
True
Is not x is None
always equivalent to x is not None
?
To break down the condition, is it not (x is None)
or (not x) is None
? Or will the former always be equivalent to the latter?