> Hmmm -- why is: > > class Foo: > __metaclass__ = MetaFoo > ... > > "ok", compared to e.g.: > > class Foo is MetaFoo: > ... > > while, again for example, > > def foo(): > ... > foo = staticmethod(foo) > > is presumably deemed "not ok" compared to e.g.: > > def foo() is staticmethod: > ... > > ??? > > Both cases of current syntax do the job (perhaps not elegantly but > they do) and in both cases a new syntax would increase elegance. Perhaps (I haven't really thought this through) because you can place the __metaclass__ thing right at the top of the class definition, while the staticmethod thing must necessarily come after the entire method definition. Also I expect that __metaclass__ usage is rather more rare than static or class methods are. And often one introduces a metaclass by inheriting from a base class whose sole (or main) purpose is to change the metaclass -- just like inheriting from object. --Guido van Rossum (home page: http://www.python.org/~guido/)
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