This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author kermode
Recipients georg.brandl, kermode
Date 2008-12-31.18:59:34
SpamBayes Score 0.0604755
Marked as misclassified No
Message-id <1230749976.35.0.878652242005.issue4793@psf.upfronthosting.co.za>
In-reply-to
Content
http://www.python.org/doc/2.6/glossary.html

The decorator entry in the Python 2.6 documentation incorrectly
describes a decorator as "merely syntactic sugar". It is not, as this
example shows:

>>> def decorator(f):
	f.prev = globals()[f.__name__]
	return f

>>> func = 0
>>> def func():
	pass

>>> func = decorator(func)
>>> func.prev
<function func at 0x00C748F0>
>>> func = 0
>>> @decorator
def func():
	pass

>>> func.prev
0

This distinction could be useful in building multi-methods, for example.
History
Date User Action Args
2008-12-31 18:59:36kermodesetrecipients: + kermode, georg.brandl
2008-12-31 18:59:36kermodesetmessageid: <1230749976.35.0.878652242005.issue4793@psf.upfronthosting.co.za>
2008-12-31 18:59:34kermodelinkissue4793 messages
2008-12-31 18:59:34kermodecreate