[Tutor] if n == 0 vs if not n
Sander Sweers
sander.sweers at gmail.com
Mon Oct 5 21:28:56 CEST 2009
Hi Tutors,
I am going through someone's python script and I am seeing a lot of the
following boolean checks.
if not s == ""
if not n == 0
if b == True
if not b == True
etc..
All of these can be written without the == notation like "if n", "if s"
etc.
Now in this case where it is only used as boolean checks which would be
the most pythonic way if writing these checks?
Thanks
Sander
More information about the Tutor
mailing list