为什么这会打印一个 False?
#! /usr/bin/env python
class A(object):
def __instancecheck__(self,arg):
print self, type(self), arg , type(arg)
if __name__ == '__main__':
a = A()
print isinstance(a,a)
给出:
$ ./isinstancecheck.py
<__main__.A object at 0x7f0574198b90> <class '__main__.A'> <__main__.A object at 0x7f0574198b90> <class '__main__.A'>
False