Differences between revisions 1 and 137 (spanning 136 versions)
Revision 1 as of 2004-08-03 20:03:12
Size: 1063
Editor: 66
Comment:
Revision 137 as of 2004-12-21 18:35:27
Size: 0
Editor: pcp07844007pcs
Comment: moving contents back to my wiki
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:

Support for decorators was proposed for Python in [http://www.python.org/peps/pep-0318.html PEP 318], and will be implemented in Python 2.4.

== What is a decorator ==

A decorator is a software design pattern. Decorators dynamically alter the functionality of a function, method, or class without having to directly use subclasses or change the source code of the function being decorated.

For more information about the decorator pattern in general, see:
 * http://wiki.cs.uiuc.edu/patternStories/DecoratorPattern
 * http://en.wikipedia.org/wiki/Decorator_pattern

== Debate about decorators in Python ==

The winning syntax as of now uses the '@' symbol. There has been a long discussion about the syntax to use for decorators in Python. See for example these threads:

 * http://article.gmane.org/gmane.comp.python.devel/61569
 * http://www.livejournal.com/users/jcalderone/3913.html

== Examples ==

{{{
!#python

@classmethod
def foo (arg1, arg2):
    ....

}}}


== Related Resources ==

See also: MixIns, MetaClasses

PythonDecorators (last edited 2016-05-20 20:14:18 by FranciscoReyes)

Unable to edit the page? See the FrontPage for instructions.