X Men 4 Origins: Wolve | West with the Night | The Daily Show 2018 01 08 Ashley Graham EXTENDED WEBRip x264 AAC mp4

, asked
Views : 4

What does built-in class attribute __bases__ do in Python?

What does built-in class attribute __bases__ do in Python?

1 Answer
Rajendra Dharmkar

This built-in class attribute when called prints the tuple of base classes of a class object.

The following code shows how the __bases__ works. B is a child class of the parent/base class A.

class A(object): pass
class B(A): pass
b = B()
print B.__bases__

This gives the output

(<class '__main__.A'>,)

Advertisements
Related Questions