is decorator the right thing to use?

Dmitry S. Makovey dmitry at makovey.net
Sun Sep 28 22:26:59 CEST 2008


George Sakkis wrote:
> FYI, in case you missed it the final version doesn't need a Proxy base
> class, just inherit from object. Also lowercased ProxyMethod to look
> similar to staticmethod/classmethod:

I cought that, just quoted the wrong one :)

> class A(object):
> 
>     def __init__(self, b1, b2):
>         self.b1 = b1
>         self.b2 = b2
> 
>     @proxymethod
>     def bmethod(self):
>         return self.b1
> 
>     @proxymethod
>     def bmethod2(self):
>         return self.b2
> 
> George




More information about the Python-list mailing list