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?