On May 3, 10:34 pm, Peter Otten <[EMAIL PROTECTED]> wrote:
> The problem is not that you are decorating a method but that you are trying
> to use a callable class instance as a method. For that to work the class
> has to implement the descriptor protocol, see
>
> http://users.rcn.com/python/downloa
Thanks Peter and 7stud. That is the solution that really works for
me.
--
http://mail.python.org/mailman/listinfo/python-list
On May 3, 7:21 pm, Andy Terrel <[EMAIL PROTECTED]> wrote:
> Okay does anyone know how to decorate class member functions?
>
> The following code gives me an error:
>
> Traceback (most recent call last):
> File "decorators2.py", line 33, in
> s.update()
> File "decorators2.py", line 13, in
Andy Terrel wrote:
> Okay does anyone know how to decorate class member functions?
>
> The following code gives me an error:
>
> Traceback (most recent call last):
> File "decorators2.py", line 33, in
> s.update()
> File "decorators2.py", line 13, in __call__
> retval = self.fn.__ca
On Thu, 03 May 2007 19:28:52 -0700, Andy Terrel wrote:
> I just need to keep the state around. I make a call to some function
> that is pretty expensive so I want to save it as a member during the
> __init__ of the decorator.
>
> Yeah I'm afraid it can't be done either, that's why I asked the gro
not quite as elegant but here is a workaround... Thanks Virgil for
taking some time to think about it.
---
class Bugger (object):
def __init__ (self, module):
print "Entering __init__"
self.module = module
self.verb = 0
def instrument (module_name):
def wrapper(f)
Andy Terrel <[EMAIL PROTECTED]> writes:
> I just need to keep the state around. I make a call to some function
> that is pretty expensive so I want to save it as a member during the
> __init__ of the decorator.
>
> Yeah I'm afraid it can't be done either, that's why I asked the group.
Have you lo
I just need to keep the state around. I make a call to some function
that is pretty expensive so I want to save it as a member during the
__init__ of the decorator.
Yeah I'm afraid it can't be done either, that's why I asked the group.
--
http://mail.python.org/mailman/listinfo/python-list
On May 3, 9:21 pm, Andy Terrel <[EMAIL PROTECTED]> wrote:
> Okay does anyone know how to decorate class member functions?
>
> The following code gives me an error:
>
> Traceback (most recent call last):
> File "decorators2.py", line 33, in
> s.update()
> File "decorators2.py", line 13, in
On May 3, 9:33 pm, Virgil Dupras <[EMAIL PROTECTED]> wrote:
> On May 3, 9:21 pm, Andy Terrel <[EMAIL PROTECTED]> wrote:
>
>
>
> > Okay does anyone know how to decorate class member functions?
>
> > The following code gives me an error:
>
> > Traceback (most recent call last):
> > File "decorators
On May 3, 9:21 pm, Andy Terrel <[EMAIL PROTECTED]> wrote:
> Okay does anyone know how to decorate class member functions?
>
> The following code gives me an error:
>
> Traceback (most recent call last):
> File "decorators2.py", line 33, in
> s.update()
> File "decorators2.py", line 13, in
Oh I should mention the decorator needs to have some notion of state
(such as with the above class)
--
http://mail.python.org/mailman/listinfo/python-list
Okay does anyone know how to decorate class member functions?
The following code gives me an error:
Traceback (most recent call last):
File "decorators2.py", line 33, in
s.update()
File "decorators2.py", line 13, in __call__
retval = self.fn.__call__(*args,**kws)
TypeError: update()
13 matches
Mail list logo