News for hackers. Stuff that matters.
Re:OO in Python is mostly pointless by joshuamorton on Wednesday January 27, 2021 @07:53PM (#25936616)
This requires blessing "self" as special (like this in java etc.). Python made a specific choice not to do that (and there are cases where you don't want to use "self", such as metaclasses, classmethods, and (rarely) nested classes that close over their parent class.

Like I said: most of the time, a missing `self` is an error by the user, and so python requires explicit notification both to the language, and to other people, that you're doing what you mean to do, and not just making a mistake.

Re:OO in Python is mostly pointless by lmm on Wednesday January 27, 2021 @08:53PM (#25937098)
I think that's the point: requiring the user to explicitly pass "self" rather than making it a language keyword mostly just gives the user an unnecessary opportunity to make mistakes.
Re:OO in Python is mostly pointless by airstrike on Wednesday January 27, 2021 @11:15PM (#25938080)
Except in Pythonland, "explicit is better than implicit"

https://www.python.org/dev/peps/pep-0020/

Re:OO in Python is mostly pointless by Sandman on Thursday January 28, 2021 @02:41AM (#25939261)
Wouldn't it be more explicit if there was a designated keyword that objects could use to access their own members instead of implicitly assuming that any first argument to a method is a reference to them, only called 'self' by convention?
Re:OO in Python is mostly pointless by joshuamorton on Thursday January 28, 2021 @03:12AM (#25939446)
> Wouldn't it be more explicit if there was a designated keyword that objects could use to access their own members

Not really. You end up implicitly injecting some value into local namespaces instead of having a function that takes an argument.

The implicitness of methods working differently than normal functions > the implicitness of classes passing a first argument to methods.

Re:OO in Python is mostly pointless by Sandman on Thursday January 28, 2021 @05:37AM (#25940320)
Should super then also be a method argument?
Re:OO in Python is mostly pointless by joshuamorton on Thursday January 28, 2021 @03:43PM (#25948904)
Honestly, I think it would have made some amount of sense to make super a method defined on the base object so that

    def __init__(self, x, y):
        self.super(x, y)
would be the convention. There may be some infra issue with this (and in general, `super` has to be kind of magical no matter how you handle it). But yes, in general I can vibe with "super is too implicit".
Re:OO in Python is mostly pointless by Joker_vD on Thursday January 28, 2021 @10:50AM (#25943728)
Ruby generally (I think? I haven't seen much of Ruby code) uses "@" instead of "self.", and "@@" instead of "ParticularClassName." (btw, "self.__class__" doesn't cut it), and it seems to produce no namespace pollution.