56hf
last updated 2 years ago by anonymous #
I quite like this, except for the way discussion of the self parameter is handled (Don't Worry It's Magic). Instead, I suggest introducing methods by pointing out that a method can be retrieved just like any other attribute by doing Student.amethod, and then invoked like any other function Student.amethod(instance, arg).
And only then introduce instance.a_method(arg) as a shorthand for the above. I believe this tendency of tutorials to treat method invocations as if they're deep dark magic is at the heart of the resentment of the 'self' parameter. The reason that parameter is there is precisely because methods really aren't magic. They're just normal class attributes that happen to be functions.
