Easy Q: dealing with object type

Erick idadesub at gmail.com
Wed Feb 2 21:11:09 EST 2005


Ah, you're running into the "old-style classes vs. new style classes".
Try subclassing from "object".

For example:

>>> class A(object):
...   pass
...
>>> a=A()
>>> type(a)
<class '__main__.A'>
>>> type(a) == A
True
>>> type(a) is A
True
>>> b=A()
>>> type(a) == type(b)
True
>>> type(a) is type(b)
True


Check out the following article, it should answer your questions:
http://www.python.org/doc/2.2.3/whatsnew/sect-rellinks.html#SECTION000310000000000000000
-e




More information about the Python-list mailing list