'if name is not None:' v. 'if name:'
J. Cliff Dyer
jcd at sdf.lonestar.org
Tue Jul 15 14:48:18 EDT 2008
On Tue, 2008-07-15 at 14:37 -0400, Victor Noagbodji wrote:
> Hello,
>
> what's the difference between these two statement? And which one should one use?
>
Aside: Please include all relevant information in the *body* of your
post, not just the subject header.
The two statements in question are:
if name is not None:
and
if name:
The difference?
name=''
if name is not None:
print "name is not None."
if name:
print "name is."
Give it a whirl.
Cheers,
Cliff
More information about the Python-list
mailing list