When I run pychecker through my modules I get the message that 
comparisons with "False" is not necessary and that it might yield 
unexpected results.

Yet in some situations I need to specifically check whether False was 
returned or None was returned. Why is comparison with False so bad?

# example code which matches both False and None
if not var:
    # do something

# specifically check if False is returned 
# I don't want None
if var == False:
   # do something

So how do you get around this? My functions return False and None under 
different circumstances. Should I raise exceptions instead? I feel it's 
unnecessary clutter to use exceptions unless absolutely no other solution 
is available and yet I have doubts about the "False" value.

-- 
Harishankar (http://harishankar.org http://lawstudentscommunity.com)

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to