To do inheritance search on attribute fetches, each instance has a link to its class.
It's called __class__:
class rec: pass # Empty namespace object rec.name = 'Bob' # Just objects with attributes rec.age = 40 # from w w w . ja va2 s. co m d = rec.__class__ # Instance to class link print( d )