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/039958.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) PEP 318 (was Re: [Python-Dev] Re: Guido's Magic Code was: inlinesort option)Guido van Rossum guido at python.org
Tue Nov 4 10:55:32 EST 2003
> 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/)

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