Ron_Adam wrote:
On Tue, 05 Apr 2005 02:55:35 -0400, Steve Holden <[EMAIL PROTECTED]>
wrote:


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.


I don't mind.  It might help me communicate my ideas better.


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.


Or it's just a communication problem, and we both understand.
Communicating is not my strongest point. But I am always willing to
clarify something I say.


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?


What I was referring to is the case:

@decorator(x,y,z)

As being a decorator expression with more than one argument.  and not:

    @decorator(x)(y)

This would give a syntax error if you tried it.


@d1(1)(2)

SyntaxError: invalid syntax

The problem I had with tuple unpacking had nothing to do with
decorators.  I was referring to a function within the class, and I
needed to be consistent with my use of tuples as arguments to
functions and the use of the '*' indicator.


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


Hope this clarifies things a bit.

Cheers,
Ron


So what you are saying is that you would like to be able to use arbitrarily complex expressions after the :at" sign, as long as they return a decorator? If so, you've been "pronounced" :-)

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/

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to