On Tuesday 04 November 2003 02:09 am, Phillip J. Eby wrote: ... > I'm not all that enthused about the metaclass usage, mainly because there's > already an okay syntax (__metaclass__) for it. I'd rather that class 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. > decorators (if added) were decorators in the same way as function > decorators. Why? Because I think that correct, combinable class > decorators are probably easier for most people to write than correct, > combinable metaclasses, and they are more easily combined than metaclasses > are. Combinable metaclasses may not be trivial to write, but with multiple inheritance it will often be feasible (except, presumably, when implied layout or __new__ have conflicting requirements). Of course, not having use cases of either custom metaclasses or class decorators in production use, the discussion does risk being a bit abstract. Did you have any specific use case in mind? Alex
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