A RetroSearch Logo

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

Search Query:

Showing content from http://mail.python.org/pipermail/python-dev/2004-March/043462.html below:

[Python-Dev] PEP 318 - posting draft

[Python-Dev] PEP 318 - posting draftGuido van Rossum guido at python.org
Wed Mar 24 10:40:07 EST 2004
> > But while you're at it, please add to the PEP that I don't like the
> > idea of class decorators.  I think they don't solve a real problem,
> > unlike function decorators, and I think that making classes and
> > functions more similar just adds confusion.
> 
> I disagree.  There's definitely a use case for something less permanent 
> than a metaclass that gets a reference to a class immediately after 
> creation but before it ends up in the module namespace.  For example, 
> ZopeX3 interfaces and PyProtocols interfaces both use sys._getframe() 
> introspection to add a temporary metaclass so that they can declare 
> that a class supports (or does not support) a particular set of 
> interfaces from the class body itself.  Using the [] syntax to decorate 
> the class would deprecate these sorts of nasty hacks.

But the use cases are certainly very *different* than those for
function/method decorators, and should be spelled out separately.

For example, I'd like to see you show in much more detail how class
decorators could be used to replace those Zope3 hacks.

--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