'if name is not None:' v. 'if name:'

Victor Noagbodji noagbodjivictor at gmail.com
Tue Jul 15 21:44:25 CEST 2008

>>what's the difference between these two statement?
>one checks if the given object is not None, the other checks if it's a true value:
>>And which one should one use?
>depends on what you want to test for, of course.

Well that's exactly why I'm asking. Since None returns False in if
statements. Why do people use if name is not None: instead of simply
writing if not name?


More information about the Python-list mailing list