How to test if an object IS another object?

wittempj@hotmail.com martin.witte at gmail.com
Sun Jun 12 16:28:13 EDT 2005


You can use the id() function to test equality of objects:

martin at ubuntu:~$ python
Python 2.4.1 (#2, Mar 30 2005, 21:51:10)
[GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a = 3
>>> b = 3
>>> id(a)
135585176
>>> id(b)
135585176
>>>




More information about the Python-list mailing list