Skip to content

7.19 - NotImplementedError in NoiseMixin-Base Class throws error bc of MRO #36

Description

@haimcqueen

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:

(<class '__main__.AnnoyingLoudCyclist'>, <class '__main__.AnnoyingMixin'>, <class '__main__.LoudMixin'>, <class '__main__.NoiseMixin'>, <class '__main__.Cyclist'>, <class 'object'>)

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.

Again, thanks so much for writing this book.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions