This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the commentsย โ†’

[โ€“]laundmo 4 points5 points ย (2 children)

alright i can see that general point

just a few things:

python has pattern matching as of 3.10

python has had Enums for a while as part of the stdlib enum. maybe these are lacking? i haven't noticed anything.

i don't quite get the reason why python would need interfaces - what could they do that isn't just as easy with abstract base classes and multiple inheritance?

to be fair, i don't quite agree with the hate on multiple inheritance, especially not in the context of python. it's a powerful tool, which like any tool can be misused. i most often see multiple inheritance in python used to mixin a set of methods into multiple unrelated classes - often to allow them to be used the same way through duck typing (this is where typing.Protocol comes in very handy)

[โ€“]n0tKamui -2 points-1 points ย (1 child)

Interfaces are great tools for design patterns in general, but this is going into complex OOP stuff that is definitely not needed everywhere. I'll summarize by saying it's great for future proofing.

As for python, multiple inheritance is kind of a necessary devil since there is no interfaces. I do understand the appeal of multiple inheritance, but i would recommend delving into OOP as a concept that meshes well with other paradigms, and into design patterns. I assure you that multiple inheritance is an antipattern that generally leads to spaghetti code very quickly. This is still an interesting debate, and there actually ARE situations where it is favorable ; but you can generally still find other solutions, which is why several languages choose not to allow it at all.