On Sun, Aug 11, 2013 at 4:09 AM, Krishnan Shankar <i.am.song...@gmail.com> wrote: > i.e. Is this code possible > > if a is False: > print 'Yes' > if b is False: > print 'No'
You would use that if you want to check if a/b is the exact bool value False. Normally you would simply spell it thus: if not a: print 'Yes' if not b: print 'No' which will accept any value and interpret it as either empty (false) or non-empty (true). Using the equality operator here adds another level of potential confusion: >>> 0 == False True >>> [] == False False >>> 0.0 == False True >>> () == False False whereas if you use the normal boolean conversion, those ARE all false: >>> bool(0) False >>> bool([]) False >>> bool(0.0) False >>> bool(()) False ChrisA -- http://mail.python.org/mailman/listinfo/python-list