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, gpolo, kermode
Date 2008-12-31.19:44:25
SpamBayes Score 0.001708994
Marked as misclassified No
Message-id <1230752667.11.0.970740513714.issue4793@psf.upfronthosting.co.za>
In-reply-to
Content
It is distinct behavior. Without a decorator a new function is
immediately assigned to the identifier. Any previous reference is lost.
A decorator postpones assignment until the decorator returns. That
allows the decorator to access the previous object. I don't know of any
way to do the same thing with:

def foo():
   .....
foo = do_something(foo)

Here is part of a comp.lang.python thread discussing the possibility of
using a decorator for an overloaded function.

http://groups.google.com/group/comp.lang.python/browse_thread/thread/16a2e8b9d6705dfb/1cb0b358173daf06?lnk=gst&q=Lenard+Lindstrom+decorator#1cb0b358173daf06

Note that the decorator could create an overloaded function without any
extra variables. To do the equivalent in Python 2.3 a special attribute,
with a mangled name, was needed to store intermediate declarations.
History
Date User Action Args
2008-12-31 19:44:27kermodesetrecipients: + kermode, georg.brandl, gpolo
2008-12-31 19:44:27kermodesetmessageid: <1230752667.11.0.970740513714.issue4793@psf.upfronthosting.co.za>
2008-12-31 19:44:26kermodelinkissue4793 messages
2008-12-31 19:44:25kermodecreate