Lenard Lindstrom <le...@telus.net> added the comment: 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. _______________________________________ 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