3 ms·
Assuming x is not a boolean, I think not x would be sufficient in the case of Python.
by seertaak 11y ago
Assuming x is not a boolean, I think
not x
would be sufficient in the case of Python.
- dragonwriter 11y agoin Python (even for non-Booleans) not x is not equivalent to "X is not None", since empty lists, zero, etc., are not truthy in a Boolean context.
- seertaak 11y agoOk, yeah, you're right -- I forgot those other cases. Thanks for the clarification.