Lenard Lindstrom <le...@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 <rep...@bugs.python.org>
<http://bugs.python.org/issue4793>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to