No multiple inheritance - ways to get same outcome without it #13729
Replies: 4 comments 2 replies
-
So we can't use subclasses in micropython?? |
Beta Was this translation helpful? Give feedback.
-
Another pattern useful in this context is composition, as in https://en.m.wikipedia.org/wiki/Composition_over_inheritance |
Beta Was this translation helpful? Give feedback.
-
Re multiple inheritance the docs state:
Translating, MI does work in MicroPython provided you don't try to be too clever. Note the link given by @karfas. There is usually a better way than using MI. In nearly ten years of MP coding I used it once. |
Beta Was this translation helpful? Give feedback.
-
I think I can close this now, composition will do the job |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to do something like this:
But MicroPython don’t support multiple inheritance and call only first super(). Is there any pattern/technic that allow me to achieve same result without multiple inheritance?
Beta Was this translation helpful? Give feedback.
All reactions