Faking whether an object is an Instance of a Class in Python
问题 Suppose I have a class FakePerson which imitates all the attributes and functionality of a base class RealPerson without extending it . In Python 3, is it possible to fake isinstance() in order to recognise FakePerson as a RealPerson object by only modifying the FakePerson class. For example: class RealPerson(): def __init__(self, age): self.age = age def are_you_real(self): return 'Yes, I can confirm I am a real person' def do_something(self): return 'I did something' # Complicated