3 ms·
Magic methods have always been my favourite part of python, they're the developers way of ensuring we can do anything that they can do, if there isn't a magic m
by Alphasite_ 13y ago
Magic methods have always been my favourite part of python, they're the developers way of ensuring we can do anything that they can do, if there isn't a magic method for it, it's not possible. We can create our own version of anything in the standard library.
Self is one of those things, if you wanted to you could easily add another instance variable, just implement getattr and have it return a partial function. Although I will admit it is one area which does cause more than its fair share of errors, but I prefer it to Ruby's methodology.
- goldenkey 13y agoAre the magic methods API frozen?