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

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • J. Cliff Dyer

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


    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


Working...