You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
In the Circle exercise, folks created methods that were not that friendly to subclassing.
use of the
__class__
attribute could help with this:similarly (and more importantly) for things like add, etc.
some notes and examples of this in the metaprogramming materials would be a good idea.
The text was updated successfully, but these errors were encountered: