[New-bugs-announce] [issue4793] Glossary incorrectly describes a decorator as "merely syntactic sugar"
Lenard Lindstrom
report at bugs.python.org
Wed Dec 31 19:59:36 CET 2008
New submission from Lenard Lindstrom <len-l at telus.net>:
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.
----------
assignee: georg.brandl
components: Documentation
messages: 78643
nosy: georg.brandl, kermode
severity: normal
status: open
title: Glossary incorrectly describes a decorator as "merely syntactic sugar"
versions: Python 2.6
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4793>
_______________________________________
More information about the New-bugs-announce
mailing list