typeof foo == 'undefined' ???

Jay Chalfant jchalfan at outbackinc.com
Fri Nov 3 17:55:24 EST 2000


Hello,

This is a valid JavaScript expression:

typeof foo == 'undefined'

and is useful in testing the existince of object member vars such as:

if ( typeof foo.bar == 'undefined' )
    print("I don't have that!")

Is there an equivalent test in Python?

thanks,

-J





More information about the Python-list mailing list