r/learnpython • u/MonsieurBouclier • Mar 12 '24
Is python OOP the real thing ?
Hello, I'm currently writing a report on a project where I used python with the OOP paradigm and I want to be sure to not talk nonsense in it.
So, here is my question : Is python really fully respecting the OOP paradigm ?
I mean, for exemple when I want to make an abstract class, the concept doesn't really seem to exist. When I write an abstract method, I am obligated to use a decorator and it doesn't even prevent from calling the parent method. So i need to have a default behavior in it...
Also another question : I have seen that only mutable parameters can be updated in the body of a function. Is it specific to python or something generalized to other languages ?
4
Upvotes
8
u/ryo0ka Mar 12 '24
To the first question: Python is a multi-paradigm language with its own design choices. Regarding abstract methods, their design choice is “why not allow for default implementation?” because it opens up flexibility and, if you ever wish, it’s trivial to explicitly write down a “don’t call me” runtime exception in your abstract methods.
Is that OOP? I think so, they have their own design like any other languages do.
To the second question, immutable objects are common across the league. The idea dates back waaaay before Python.