
Aug. 16, 2004
4:38 a.m.
On Aug 15, 2004, at 11:45 PM, Jack Diederich wrote:
My patch to add support for class decorators defines func before the decorators as a side effect of moving Mark's decorator code out of com_funcdef (and yes, that was a plug).
That's definitely worse. It causes a possibly incorrect temporary value to be bound, even if only for a short amount of time. The current behavior of only doing the store after executing the decorators is cleaner. I'd rewrite the translation as: """ The following code: @f1(arg) @f2 def func(): return True is nearly* equivalent to: func = f1(arg)(f2(lambda : True)) * However, you don't have the syntactical restrictions of a lambda, and the function name gets set to "func" instead of "<lambda>". """ James