Multiple inheritance & __init__

is this a feature :rofl:

class Foo():
    def __init__(self, *args, **kw):
        print("foo init")
        super().__init__(*args, **kw)

class Bar():
    def __init__(self, bar):

class FooBar(Foo, Bar):
    def __init__(self):
        print("foobar init")
        super().__init__('bar init')

a = FooBar()

Yes it is.

1 Like

I definitely need to include a write-up of this topic on my list.

Is what a feature?

Not sure, but it definitely is one.

Probably the ability to define unmaintainably tightly-coupled classes?

In all seriousness: YES, it is a feature that you are allowed to do things that no sane programmer would ever want to do. That’s called freedom and it’s a spectacular feature.


I’ve seen it in a wx chunk were it doesn’t make any sense and, in fact, ruins the real task (sometimes one lacks phantasy) :face_with_diagonal_mouth: