3 ms·
I hadn't wanted to get into the weeds of Python, but yes. You could use any identifier you want, but breaking with convention in this way is not a wise move. I
by MaxBarraclough 6y ago
I hadn't wanted to get into the weeds of Python, but yes. You could use any identifier you want, but breaking with convention in this way is not a wise move.
I consider it a mistake on the part of Python to go with self rather than this, but it's a really bad idea to write code that surprises other programmers in that way.
- masklinn 6y ago> I consider it a mistake on the part of Python to go with self rather than this self makes more sense though. And smalltalk used self. And so did (obviously) Self. The most important part is to not use both (which of course is what PHP does).
- m_t 6y agoYeah but to quote stackoverflow: > Use $this to refer to the current object. Use self to refer to the current class. In other words, use $this->member for non-static members, use self::$member for static members. This is a different way of doing things, yes, but it makes sense.