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

8

u/m0us3_rat Mar 12 '24

do you have a python specific question or just ramblings?

there are abstract classes or protocols

8

u/Mr_Lifewater Mar 12 '24

That tone is not very pythonic.

-4

u/m0us3_rat Mar 12 '24

sir yes sir.. i'mma be more careful next time i see your mom.

4

u/Mr_Lifewater Mar 12 '24

Neither is that. Are you even trying here?

-8

u/m0us3_rat Mar 12 '24

i do my best. did she say something?

4

u/Mr_Lifewater Mar 12 '24

She’s dead

3

u/kronik85 Mar 12 '24

Don't wrestle with pigs.

-3

u/m0us3_rat Mar 12 '24

that's unfortunate. do you have any python related question or?

0

u/[deleted] Mar 12 '24

[deleted]

0

u/m0us3_rat Mar 12 '24

the top comment put it very clearly..

How would you “update” a value that is immutable and therefore can’t change?

the OP doesn't seem to understand what is he trying to express.

he is using domain specific language without domain specific knowledge.

thus being.. clearly confused.

my pet peeve of ppl using words they don't necessarily understand..which sometimes i'm guilty myself..

just simplify. right?

to your point

Did you struggle to understand what they were asking?

Op didn't even understand himself what he was talking about.. so i get that you seem angry somehow..but i'm not sure exactly why.

whatever.

You can see other people had educational comments to make. I learned from them. Others learned from them. Whatever you wrote at the end there was pretty useless but stated like it’s some gift about to lead to an epiphany

that isn't accurate. the part about my comment..

as far as i understood.. OP claimed he can't make "abstract classes" in python..

which isn't true since you can use "protocol" or "abstract classes".

as i stated.

there are abstract classes or protocols

https://peps.python.org/pep-0544/#defining-a-protocol

https://docs.python.org/3/library/abc.html

they are completely different but also quite similar as far as "beginner" usability.

so, i actually gave a fairly direct response to what i believed OP was asking.

hope this clears it for you.

gl

2

u/aqjo Mar 12 '24

This is, after all, r/learnpython, and I see two questions in the original post.

-2

u/mfb1274 Mar 12 '24
class NotOop(metaclass=abc.ABCMeta):
    “””Ramblings from a college student who just read their professors self published Java book from the 1990s”””
    pass