inheritance and polymorphism Flashcards
1
Q
determine if an object is of specified type
A
isinstance(object, class)
2
Q
determine if a type is a subclass of another
A
issubclass(type, anotherclass)
3
Q
a tuple of base classes of class object
A
__bases__
4
Q
tuple mro of class
A
__mro__
5
Q
get list mro of class
A
mro()
6
Q
algorithm for calculating mro
A
c3
7
Q
what returns super() ?
A
super returns a proxy object which routes method calls
8
Q
two types of bound proxies
A
class bound instance bound
9
Q
class-bound proxy
A
super(base_class, derived_class)
10
Q
instance-bound proxy
A
super(class, instance-of-a-class)