I understand that since type / class unification, each value has a type that comes from object
. However, I can not find absolute confirmation of this in the documents. Although it is reasonable that isinstance(anything, object)
should always be True
, I could also imagine that there are outdated edge cases in the Python 2 codebase. Does anyone know an example where isinstance(value, object)
not True
?
Context: as part of the type hierarchy I am developing, there is an all-inclusive Alpha
type for which I want isinstance(obj, Alpha)
always return True
. I think in Python 2.6+ ABCMeta.register(object)
should do the trick, but I want to be sure.
EDIT: for the sake of posterity, ABCMeta.register(object)
will not work (try). Ethan Furman provides an alternative solution for this case in his answer below.
maaku source share