George Sakkis wrote: > It's funny how often you come with a better solution a few moments > after htting send! The snippet above can (ab)use the decorator syntax > so that it becomes: > > class A(Proxy): > > @ProxyMethod > def bmethod(self): > return self.b1 > > @ProxyMethod > def bmethod2(self): > return self.b2
That is outstanding! This code looks very clean to me (just a touch cryptic around declarations in A, but that was unavoidable anyway). Seems like the right way to read it would be bottom up (or is it only my mind so perverted?). By the looks of it - it does exactly what I needed with great number of possibilities behind it and is very lightweight and transparent. Now I regret I haven't come up with it myself :-D George, at this point I'm out of rugs - so no more rug pulling from under your feet for me. Now I'm going to apply all this knowledge to my code, see how that goes and come back with more questions later. Thank you (all) very much for a great discussion. This thread educated me quite a bit on descriptors and why one would need them, and decorators - just as subject line suggested, were not forgotten. -- http://mail.python.org/mailman/listinfo/python-list