A great article on what is "self" in Python, by @ehmatthes

https://www.mostlypython.com/what-is-self/
What is `self`?

MP 162: It's been answered many times, but it's always worth revisiting. I've been reflecting on classes lately, and how we teach them. One of the questions that comes up in every discussion about OOP with people who are seeing it for the first time in Python is this: What

Mostly Python

@stfn @ehmatthes A bit superficial, perhaps. Explain:

>>> class Bird: ... def sing(self): ... print(self) ... >>> Bird.sing(42) 42

@edavies @ehmatthes in your example you are not instantiating Bird, so 42 does not refer to the class instance.

@edavies @stfn That article was meant to be one way to look at self, to help people think about what it's pointing to in different contexts.

Your snippet is interesting. Are you asking for an explanation because you're not sure what's going on here, or because you're not sure I can explain it?

@ehmatthes @stfn As far as I know, I understand it reasonably well. (I'm not entirely clear on what makes an object member which is a function be a method and hence have this behaviour). What I'm pointing out is that your explanation will not help people understand what's really going on.

I'm thinking a more helpful explanation might be on the lines of a.b(c) is sort of equivalent to b(a, c) but with b found in a's context (which includes a's class and its superclasses).