You want isinstance(a, A) .
Keep in mind that it is better to avoid checking isinstance by adding methods to A that force it to do what you want, without explicitly defining that it is A
is determines whether two objects are the same object.
source share