[Python-Dev] Re: decorators and 2.4
Phillip J. Eby
pje at telecommunity.com
Fri Jun 25 19:20:08 EDT 2004
At 05:53 PM 6/25/04 -0500, Contempt for Meatheads wrote:
>IMHO, making decorators functions is a bad idea. Decorators are metadata
>about the function to which they refer. Using the same syntax for
>decorators as for functions conceptually weakens this distinction and
>encourages misuse of decorators, even to the point of potentially
>encouraging (or implying) side-effects as a result of decoration.
Side-effects are desired by various current users of decorators, so whether
this will "encourage" them is moot. Further, those uses often suggest that
"metadata" is far too narrow of a word to encompass the desired uses of
decorators.
Last, keep in mind that there is nothing stopping people today from doing
whatever they want with functions *anyway*, in every version of Python I've
ever used (back to 1.4):
def foo(...):
...
do_something_with(foo)
So, again, the idea that this somehow becomes a bad thing when it goes at
the top of the function definition -- where it should be more visible to
the reader that it's taking place -- seems a bit odd to me.
More information about the Python-Dev
mailing list