is decorator the right thing to use?

Bruno Desthuilliers bdesth.quelquechose at free.quelquepart.fr
Thu Sep 25 13:31:41 EDT 2008


Aaron "Castironpi" Brady a écrit :
(snip)
> You should write it like this:
> 
> class B(object):
>      @A.proxy
>      def bmethod(self,a):
> 
> Making 'proxy' a class method on A.

That's exactly what I wanted to avoid here : making B depending on A.

(snip)

> I agree that __setattr__ is the canonical solution to proxy,

Err... I assume you mean '__getattr__' ???

> but you
> have stated that you want each proxied method to be a member in the
> proxy class.

This doesn't necessarily imply that "proxied" classes need to know about 
  the "proxying" class. FWIW, that was the whole point : decoupling.




More information about the Python-list mailing list