easy question on parsing python: "is not None"
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Mon Aug 9 16:14:26 EDT 2010
En Mon, 09 Aug 2010 08:41:23 -0300, saeed.gnu <saeed.gnu at gmail.com>
escribió:
> "x is y" means "id(y) == id(y)"
> "x is not y" means "id(x) != id(x)"
No; consider this:
py> id([])==id([])
True
py> [] is []
False
Comparing id's is the same as using the is operator only if you can
guarantee that both operands are alive at the same time.
--
Gabriel Genellina
More information about the Python-list
mailing list