easy question on parsing python: "is not None"

saeed.gnu saeed.gnu at gmail.com
Mon Aug 9 07:41:23 EDT 2010


"x is y"          means   "id(y) == id(y)"
"x is not y"      means   "id(x) != id(x)"
"x is not None"   means   "id(x) != id(None)"

"x is not None"  is a really silly statement!! because id(None) and id
of any constant object is not predictable! I don't know whay people
use "is" instead of "==". you should write "if x!=None" instead of "x
is not None"



More information about the Python-list mailing list