Decorator Base Class: Needs improvement.
Steve Holden
steve at holdenweb.com
Tue Apr 5 02:55:35 EDT 2005
Ron_Adam wrote:
> Ok, that post may have a few(dozen?) problems in it. I got glitched
> by idles not clearing variables between runs, so it worked for me
> because it was getting values from a previous run.
>
> This should work better, fixed a few things, too.
>
> The decorators can now take more than one argument.
> The function and arguments lists initialize correctly now.
>
Ron:
I've followed your attempts to understand decorators with interest, and
have seen you engage in conversation with many luminaries of the Python
community, so I hesitate at this point to interject my own remarks.
In a spirit of helpfulness, however, I have to ask whether your
understanding of decorators is different from mine because you don't
understand them or because I don't.
You have several times mentioned the possibility of a decorator taking
more than one argument, but in my understanding of decorators this just
wouldn't make sense. A decorator should (shouldn't it) take precisely
one argument (a function or a method) and return precisely one value (a
decorated function or method).
> It doesn't work with functions with more than one variable. It seems
> tuples don't unpack when given to a function as an argument. Any way
> to force it?
>
>
> class Decorator(object):
[...]
Perhaps we need to get back to basics?
Do you understand what I mean when I say a decorator should take one
function as its argument and it should return a function?
regards
Steve
--
Steve Holden +1 703 861 4237 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/
More information about the Python-list
mailing list