| > The code to call super is awkward. Instead of saying super(MyClass, self).foo(), I would rather just say super.foo(). That's been changed in Python 3. Although it brings other issues. > Creating a class method using a method decorator. Using a decorator to do something like this seems like a hack to me. Why? Even more so, why is a decorator more of a hack than adding a new keyword (java) or special-casing method declaration (ruby) itself? Note that you can also create class methods without decorators if you wish to, by using a metaclass (I believe the method won't be accessible from the instance though) > This seems weird and inconsistent with the how method declarations work. It's actually very coherent: every binding created in the class scope is collected and set on the class object, as if passed as the third argument to `type`. That's it. Some objects (functions) are processed a bit more, but they still end up in the same place. > methods only become class methods when a decorator is used That's because the decorator is basically a flag to tell the attribute-resolution process to handle this method differently from the normal method-resolution process. |
>> methods only become class methods when a decorator is used
> That's because the decorator is basically a flag to tell the attribute-resolution process to handle this method differently from the normal method-resolution process.
Do you see how that's just special-casing method declaration in a similar way to Ruby's mechanism, just relying on the programmer to drive the mechanism himself? To a not-so-casual observer it looks like Guido wasn't willing or able to change enough semantics to make a syntactic fix work for class method declaration, despite there being an obvious space in the syntax for it to fit in, so lent on a convenient implementation detail - a hack - to get the same effect with more work for the programmer.
Of course, it's equally possible that he believes that class methods are a code smell and should be explicitly made ugly, which I could have a certain sympathy for, but to me the current situation just looks really inelegant.