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
{{ message }}
Repository navigation
7.19 - NotImplementedError in NoiseMixin-Base Class throws error bc of MRO #36
Thank you so much for your book, it's nothing short of amazing.
On to the issue - I am not sure if I just didn't understand correctly or if it actually is an issue:
At the end of chapter 7.19 you talk about design guidelines. The second one is about implementing a base mixin class. In the exampleNoiseMixin raises an NotImplementedError. So when I call AnnoyingLoudCyclist.__mro__ with
class AnnoyingLoudCyclist(AnnoyingMixin, LoudMixin, Cyclist): pass
like before, I get the following output:
NoiseMixin comes before Cyclist in the MRO which means that when I initiate an instance of the class and call the noise method, I always get the NotImplementedError although the Cyclist class implemented the noise method.
Glad you like the book! Let me look at this. Interesting. I'm inclined to refine that advice to only do this if the existence of a noise() method (elsewhere) can't be guaranteed.
Activity
dabeaz commentedon Mar 23, 2023
Glad you like the book! Let me look at this. Interesting. I'm inclined to refine that advice to only do this if the existence of a
noise()method (elsewhere) can't be guaranteed.