I wonder what is better/best:
>>> def command():
... return False
...
>>> assert command() == False
>>> assert command() is False
>>> assert not command()
Cheers, Markus
Coding conventions can be studied here: PEP 8 Style Guide for Python Code
There you will find:
Don't compare boolean values to True or False using ==
Yes: if greeting:
No: if greeting == True:
Worse: if greeting is True:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With