Jacek Generowicz <[EMAIL PROTECTED]> wrote: > > BJörn Lindqvist <[EMAIL PROTECTED]> writes: > > > I think the essence of decorators is that it makes it possible to do > > in Python what you in other languages do with method qualifiers. > > I find it fascinating that the addition of a bit of syntax sugar gives > the perception that a whole range of new and previously unthinkable > possibilities have opened themselves before us. > > @X > def Y... > ... > > > is merely syntax sugar (or syntax ammonia, for some) for > > > def Y... > ... > Y = X(Y) > > Anything you can do with decorators, you could do before (with the > exception of rebinding the __name__ of functions). > > And yet, that bit of syntax sugar really _does_ make a big difference > to the lengths that people are prepared to take the possibilities that > the underlying feature affords them.
Technically, everything can be performed in assembly. The point of syntactic sugar (or ammonia) is to make things less painful. While everything was possible before, adding the decorators /after/ defining the function hid the decorators, and was susceptible to mistyping. I previously posted about Philip Eby's use of decorators in PyObjC. In his case, it saved him from typing 40-character function names 3 times. - Josiah -- http://mail.python.org/mailman/listinfo/python-list