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

Fredrik Lundh fredrik at pythonware.com
Tue Jul 15 20:52:22 CEST 2008


Victor Noagbodji wrote:

> 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:

     http://docs.python.org/ref/Booleans.html#Booleans

 > And which one should one use?

depends on what you want to test for, of course.

</F>




More information about the Python-list mailing list