r/learnpython • • 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

35 comments sorted by

View all comments

1

u/[deleted] Mar 12 '24 edited Mar 12 '24

Regarding your question about abstraction:

You could have you you class inherit from the AbstratctBaseClass module to do this. You figured out the decorator from the same module after all? (from abc import ABC).

The way it works and also with @abstractmethod is that it just prevents you from making instances of that class or method.

You could of course also do this manually if you wanted.