Python - Class __bases__ attribute

Introduction

Classes have a __bases__ attribute, which is a tuple of references to their superclass objects.

Demo

class rec: pass              # Empty namespace object 
rec.name = 'Bob'             # Just objects with attributes 
rec.age  = 40 #  ww w . ja  v a2 s.c o  m

d = rec.__bases__            # Class to superclasses link, () in 2.X 
print( d )

Result

Related Topic