Re: Class decorators do not inherit properly

2007-07-16 Thread Bruno Desthuilliers
Lee Harr a écrit : >>>I think the term "class decorator" is going to eventually >>>mean something other than what you are doing here. I'd >>>avoid the term for now. >>> >>> >>>When you decorate a class method, >>>the function you use >>>needs to be defined before the method definition. >> >>FWIW, t

Re: Class decorators do not inherit properly

2007-07-13 Thread Lee Harr
>> I think the term "class decorator" is going to eventually >> mean something other than what you are doing here. I'd >> avoid the term for now. >> >> >> When you decorate a class method, >> the function you use >> needs to be defined before the method definition. > > FWIW, the term "class metho

Re: Class decorators do not inherit properly

2007-07-13 Thread Diez B. Roggisch
Chris Fonnesbeck schrieb: > I have a class that does MCMC sampling (Python 2.5) that uses decorators > -- one in particular called _add_to_post that appends the output of the > decorated method to a class attribute. However, when I > subclass this base class, the decorator no longer works: > >

Re: Class decorators do not inherit properly

2007-07-13 Thread Bruno Desthuilliers
Chris Fonnesbeck a écrit : > I have a class that does MCMC sampling (Python 2.5) that uses decorators > -- one in particular called _add_to_post that appends the output of the > decorated method to a class attribute. > However, when I > subclass this base class, the decorator no longer works: >

Re: Class decorators do not inherit properly

2007-07-13 Thread Bruno Desthuilliers
Lee Harr a écrit : >> Traceback (most recent call last): >> File "/Users/chris/Projects/CMR/closed.py", line 132, in >> class M0(MetropolisHastings): >> File "/Users/chris/Projects/CMR/closed.py", line 173, in M0 >> @_add_to_post >> NameError: name '_add_to_post' is not defined >> >> y

Re: Class decorators do not inherit properly

2007-07-12 Thread Lee Harr
> Traceback (most recent call last): > File "/Users/chris/Projects/CMR/closed.py", line 132, in > class M0(MetropolisHastings): > File "/Users/chris/Projects/CMR/closed.py", line 173, in M0 > @_add_to_post > NameError: name '_add_to_post' is not defined > > yet, when I look at the dict

Class decorators do not inherit properly

2007-07-12 Thread Chris Fonnesbeck
I have a class that does MCMC sampling (Python 2.5) that uses decorators -- one in particular called _add_to_post that appends the output of the decorated method to a class attribute. However, when I subclass this base class, the decorator no longer works: Traceback (most recent call last): F