Re: Decorator Base Class: Needs improvement.

2005-04-06 Thread Ron_Adam
>I find I am still left asking the question "why would anyone want to do >that?". You didn't say which part you were referring too. As far as wrapping the same exact wrapper more than once. You probably wouldn't do that. It's just easier to test the use of multiple wrappers that way. As far as

Re: Decorator Base Class: Needs improvement.

2005-04-06 Thread Scott David Daniels
Guess I am listening to language funny today. Steve Holden wrote: By the way, we pass *parameters* to functions, *perimeters* surround things. But we do pass parameters *around*, which may be the source of the confusion. :-) -Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/

Re: Decorator Base Class: Needs improvement.

2005-04-06 Thread Steve Holden
Ron_Adam wrote: On Wed, 06 Apr 2005 08:10:22 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: I don't understand your seeming fixation with wrappers and wrapping. Fixated implies, I'm stuck on a single thing, but I'm not. I am learning as I go, and exploring some possibilities as well. :-) That's

Re: Decorator Base Class: Needs improvement.

2005-04-06 Thread Ron_Adam
On Wed, 06 Apr 2005 08:10:22 GMT, [EMAIL PROTECTED] (Bengt Richter) wrote: >I don't understand your seeming fixation with wrappers and wrapping. Fixated implies, I'm stuck on a single thing, but I'm not. I am learning as I go, and exploring some possibilities as well. :-) > That's not >the only

Re: Decorator Base Class: Needs improvement.

2005-04-06 Thread Scott David Daniels
Bengt Richter wrote: @deco.one > def foo(): pass Ok, now what do you call this @-line? Freaky decorator factory invocation? Decoratoriferous expression? ;-) This one has a certain je ne sais quoi ;-), but I'd call "deco.one" the decorator function (since it _must_ evaluate to a function), and if i

Re: Decorator Base Class: Needs improvement.

2005-04-06 Thread El Pitonero
Bengt Richter wrote: > On 5 Apr 2005 19:28:55 -0700, "El Pitonero" <[EMAIL PROTECTED]> wrote: > > >Scott David Daniels wrote: > >> Ron_Adam wrote: > >> > ... > >> > >> def tweakdoc(name): > >> def decorator(function): > >>function.__doc__ = 'Tweak(%s) %r' % (name, function.__d

Re: Decorator Base Class: Needs improvement.

2005-04-06 Thread Bengt Richter
On Wed, 06 Apr 2005 02:31:05 GMT, Ron_Adam <[EMAIL PROTECTED]> wrote: >On Tue, 05 Apr 2005 19:38:38 -0400, Steve Holden <[EMAIL PROTECTED]> >wrote: > > >>> >>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 >>

Re: Decorator Base Class: Needs improvement.

2005-04-06 Thread Bengt Richter
On 5 Apr 2005 19:28:55 -0700, "El Pitonero" <[EMAIL PROTECTED]> wrote: >Scott David Daniels wrote: >> Ron_Adam wrote: >> > ... >> >> def tweakdoc(name): >> def decorator(function): >> function.__doc__ = 'Tweak(%s) %r' % (name, function.__doc__) >> return function >>

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread Ron_Adam
On Wed, 06 Apr 2005 16:33:24 +1200, Greg Ewing <[EMAIL PROTECTED]> wrote: >Ron_Adam wrote: >> I would have preferred the @ symbol to be used as an inline assert >> introducer. Which would have allowed us to put debug code anywhere we >> need. Such as @print total @. > >Don't lose heart, there

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread Greg Ewing
Ron_Adam wrote: I would have preferred the @ symbol to be used as an inline assert introducer. Which would have allowed us to put debug code anywhere we need. Such as @print total @. Don't lose heart, there are still two unused characters left, $ and ?. ? might even be more mnemonic for this pu

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread Ron_Adam
On Tue, 05 Apr 2005 19:38:38 -0400, Steve Holden <[EMAIL PROTECTED]> wrote: >> >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 No

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread El Pitonero
Scott David Daniels wrote: > Ron_Adam wrote: > > ... > > def tweakdoc(name): > def decorator(function): > function.__doc__ = 'Tweak(%s) %r' % (name, function.__doc__) > return function > return decorator > > What is confusing us about what you write is tha

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread Steve Holden
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

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread Ron_Adam
On Tue, 05 Apr 2005 14:32:59 -0700, Scott David Daniels <[EMAIL PROTECTED]> wrote: >Ron_Adam wrote: >> What I was referring to is the case: >> @decorator(x,y,z) >> As being a decorator expression with more than one argument. >But, we generally say this is a call to a function named decorato

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread Scott David Daniels
Ron_Adam wrote: What I was referring to is the case: @decorator(x,y,z) As being a decorator expression with more than one argument. But, we generally say this is a call to a function named decorator that returns a decorator. If you called it: @make_decorator(x,y) def . We'd be s

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread Ron_Adam
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. >> >> Thi

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread Kay Schluehr
Bengt Richter wrote: > From the 2.4 Grammar, the key part seems to be > > decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE > decorators: decorator+ > funcdef: [decorators] 'def' NAME parameters ':' suite > > and further on > > dotted_name: NAME ('.' NAME)* > > So the Python

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread Kay Schluehr
Bengt Richter wrote: > From the 2.4 Grammar, the key part seems to be > > decorator: '@' dotted_name [ '(' [arglist] ')' ] NEWLINE > decorators: decorator+ > funcdef: [decorators] 'def' NAME parameters ':' suite > > and further on > > dotted_name: NAME ('.' NAME)* > > So the Python

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread Bengt Richter
On 5 Apr 2005 00:54:25 -0700, "Kay Schluehr" <[EMAIL PROTECTED]> wrote: >Steve Holden wrote: > >> 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'

Re: Decorator Base Class: Needs improvement.

2005-04-05 Thread Kay Schluehr
Steve Holden wrote: > 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 precise

Re: Decorator Base Class: Needs improvement.

2005-04-04 Thread Steve Holden
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 argu

Re: Decorator Base Class: Needs improvement.

2005-04-04 Thread Ron_Adam
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 fun

Decorator Base Class: Needs improvement.

2005-04-04 Thread Ron_Adam
Hi, Thanks again for all the helping me understand the details of decorators. I put together a class to create decorators that could make them a lot easier to use. It still has a few glitches in it that needs to be addressed. (1) The test for the 'function' object needs to not test for a s