A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-November/039940.html below:

PEP 318 (was Re: [Python-Dev] Re: Guido's Magic Code was: inlinesort option)

PEP 318 (was Re: [Python-Dev] Re: Guido's Magic Code was: inlinesort option)Alex Martelli aleaxit at yahoo.com
Tue Nov 4 03:24:13 EST 2003
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


More information about the Python-Dev mailing list

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