Steven Bethard wrote: > My only (mild) concern is that if staticmethod is going to get a > __call__, I think classmethod should probably get one too. Inside a > class this doesn't make much sense: I agree, make sense or not, if "@staticmethod def foo()" and a simple "def foo(self)" can all be called inside class definition, "@classmethod def foo(cls)" should too. > Anyway, my feeling was that running into this behavior (that > staticmethod is not callable) is a good oportunity to explain how > descriptors work. And once you start playing around with staticmethod > and classmethod, you're going to need to learn that pretty soon > anyway. Hiding it a little bit longer with a __call__ method on > staticmethod isn't going to help much in the long run. The problem is that even after explaining descriptors (which IMHO can be a more advanced feature for newbies), you still need a workaround and you might end up with (or call __get__): class A: def foo(): pass bar = foo() foo = staticmethod(foo) Which I find sad considering all the energy debating @decorators;) Regards, Nicolas
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4