I recently developed a class named DocumentWrapper around some ORM document object in Python to transparently add some features to it without changing its inter
You can use the __instancecheck__ magic method to override the default isinstance behaviour:
@classmethod
def __instancecheck__(cls, instance):
return isinstance(instance, User)
This is only if you want your object to be a transparent wrapper; that is, if you want a DocumentWrapper to behave like a User. Otherwise, just expose the wrapped class as an attribute.
This is a Python 3 addition; it came with abstract base classes. You can't do the same in Python 2.