Question: write a python recursive function return the same result (set) as picture. def bases(aclass): We learned that when we declare a class using inheritance, the

write a python recursive function return the same result (set) as picture.
def bases(aclass):
We learned that when we declare a class using inheritance, the _bases_ attribute of the class is bound to a tuple of references to its base classes. Write a recursive function named bases that takes a reference to any class and returns a set containing that class and all its base classes (back to object). You may not use the _mro_ or _mro_ attributes of the class, which would trivialize your function. You may use both iteration (over the _bases_ list) and recursion. For example, given the following class definitions in a Script class F: pass class C: pass class G: pass class B(F): pass class D(G): pass class A(B, C, D): pass
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
