On Aug 9, 3:41 pm, "saeed.gnu" <saeed....@gmail.com> wrote: > "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"
Although small objects are unique in the memory (with a unique id) and using "is" works ok, but that's not logical to compare id's when we actually want to compare values! -- http://mail.python.org/mailman/listinfo/python-list