Hacker News new | ask | show | jobs
by yen223 5031 days ago
All those self statements.
1 comments

What's even worse IMO is the lack of a proper built-in 'super'. The self parameters at least serve the purpose of deciding whether a function is a class function or object function.

So yeah, I agree, python's OOP is kind of awkward. I love the ease of composition though, something I use extensively even in other languages since I know python.

> The self parameters at least serve the purpose of deciding whether a function is a class function or object function.

No, it does not.

It doesn't do that for the interpreter / compiler. But it's a common enough idiom that the human reader can rely on it.
To elaborate on masklinn's answer, you need to add the @classmethod decorator to get a class method instead of an instance method.