Re: Decorators inside of class and decorator parameters

2007-01-14 Thread MR
Wow. Really neat stuff there. memoize seems especially cool since you can get lots of nice dynamic programming benefits "for free" (sorry if I just stated the obvious, but I thought was was especially cool.) Michele Simionato wrote: > Gabriel Genellina wrote: > > see this article by M. Simoniato

Re: Decorators inside of class and decorator parameters

2007-01-14 Thread MR
Thanks so much for your reply. You've definitely helped me a great deal on this. Your comment about the difference between define time and instantiation time cleared things up more than anything, and that also helped clear up the confusion I was having about "self". I think the places I've seen d

Re: Decorators inside of class and decorator parameters

2007-01-14 Thread Gabriel Genellina
"Michele Simionato" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > Gabriel Genellina wrote: >> see this article by M. Simoniato >> http://www.phyast.pitt.edu/~micheles/python/documentation.html for a >> better >> way using its decorator factory. > > Actually the name is Simio

Re: Decorators inside of class and decorator parameters

2007-01-14 Thread Gabriel Genellina
"Colin J. Williams" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > Gabriel Genellina wrote: >> As said in the beginning, there is no use for decorators as methods >> (perhaps >> someone can find a use case?) > Except, perhaps to indicate to the script reader that the decorat

Re: Decorators inside of class and decorator parameters

2007-01-14 Thread Colin J. Williams
Gabriel Genellina wrote: [snip] > As said in the beginning, there is no use for decorators as methods (perhaps > someone can find a use case?) Except, perhaps to indicate to the script reader that the decorator only applies within the class? Colin W. > If you move the example above inside the cl

Re: Decorators inside of class and decorator parameters

2007-01-14 Thread Michele Simionato
Gabriel Genellina wrote: > see this article by M. Simoniato > http://www.phyast.pitt.edu/~micheles/python/documentation.html for a better > way using its decorator factory. Actually the name is Simionato ;) I have just released version 2.0, the new thing is an update_wrapper function similar to th

Re: Decorators inside of class and decorator parameters

2007-01-13 Thread Gabriel Genellina
"MR" <[EMAIL PROTECTED]> escribió en el mensaje news:[EMAIL PROTECTED] > I have a question about decorators, and I think an illustration would > be helpful. Consider the following simple class: > > #begin code > class Foo: >def fooDecorator(f): >print "fooDecorator" > >def _f(

Decorators inside of class and decorator parameters

2007-01-13 Thread MR
Hello All, I have a question about decorators, and I think an illustration would be helpful. Consider the following simple class: #begin code class Foo: def fooDecorator(f): print "fooDecorator" def _f(self, *args, **kw): return f(self, *args, **kw) retur