[issue4793] Glossary incorrectly describes a decorator as "merely syntactic sugar"
Lenard Lindstrom
report at bugs.python.org
Wed Dec 31 22:17:54 CET 2008
Lenard Lindstrom <len-l at telus.net> added the comment:
The claim "merely" syntactic sugar implies that the inverse is also
true, the decorator expression:
@do_something
def foo():
....
can be replaced it with:
def foo():
....
foo = do_something(foo)
This is guaranteed if do_something is purely functional, but breaks if
do_something has side effects. The example was for illustration only. A
real application would likely access the parent frame. Whether or not
this is a questionable practice, it happens.
However, the issue is one of definitions. Is the phrase "merely
syntactic sugar" misleading? In this case it makes promises that may not
be kept.
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4793>
_______________________________________
More information about the Python-bugs-list
mailing list