Open
Description
In the Circle exercise, folks created methods that were not that friendly to subclassing.
use of the __class__
attribute could help with this:
In [61]: class C:
...: def test_name(self):
...: print("class name is:")
...: print(self.__class__.__name__)
...:
In [62]: c = C()
In [63]: c.test_name()
class name is:
C
similarly (and more importantly) for things like add, etc.
some notes and examples of this in the metaprogramming materials would be a good idea.