Author rgammans
Recipients rgammans
Date 2010-01-03.19:13:31
SpamBayes Score 2.46405e-08
Marked as misclassified No
Message-id <>
The following sequence causes isinstance to raise an exception rather than to return False.

>>> class foo:
...     pass
>>> import collections
>>> isinstance(foo,collections.Callable)
>>> isinstance(foo(),collections.Callable)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/", line 131, in __instancecheck__
    return (cls.__subclasscheck__(subclass) or
  File "/usr/lib/python2.6/", line 147, in __subclasscheck__
    ok = cls.__subclasshook__(subclass)
  File "/usr/lib/python2.6/", line 117, in __subclasshook__
    if any("__call__" in B.__dict__ for B in C.__mro__):
AttributeError: class foo has no attribute '__mro__'
Date User Action Args
2010-01-03 19:13:33rgammanssetrecipients: + rgammans
2010-01-03 19:13:33rgammanssetmessageid: <>
2010-01-03 19:13:31rgammanslinkissue7624 messages
2010-01-03 19:13:31rgammanscreate