Is vs Equality Operator

Good Z goodz158 at yahoo.com
Thu May 1 02:58:03 EDT 2008


Hello, 
I am having problem in using is. Here is what i am doing.

x=''
if x is None or x is '':
        return 1

The above statement does not return value 1.

If i changed the above check to 
if x == None or x == '':
        return 1
Now it works fine.

Any idea. What is happening here. I am using python 2.4.4 on ubuntu.

Mike


      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20080430/047483a7/attachment.html>


More information about the Python-list mailing list