Instance Variables
This is called an instance variable. Any variable defined with self. as a "prefix" can be used in any method of an object. Typically such variables are created in __init__, so they can be accessed from the moment the object is initialized, though you can define instance variables in other methods. For example:
>>> class foo:
... def fun(self):
... self.heh=3
...
>>> f = foo()
>>> f.heh
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: foo instance has no attribute 'heh'
>>> f.fun()
>>> f.heh
3
Notice the danger in initializing instance variables outside of __init__; if the method in which they are initialized is not called before you try to access them, you get an error.
Class Variables
This is not to be confused with "class variables," which are another type of variable that can be accessed by any method of a class. Class variables can be set for an entire class, rather than just specific objects of that class. Here's an example class with both instance and class variables to show the difference:
class MyClass:
classVar = "I'm a class var."
def __init__(self):
self.instanceVar = "I'm an instance var."
def fun(self):
methodVar = "I'm a method var; I cannot be accessed outside of this method."
self.instanceVar2 = "I'm another instance var, set outside of __init__."
A Note on "methods" vs "functions"
In your question, you call sing_me_a_song a "function." In reality, it is a method of the class Song. This is different from a regular old function, because it is fundamentally linked up with the class, and thus objects of that class as well.