Fredrik Lundh wrote:
> [EMAIL PROTECTED] wrote:
>
> > And they do take arguments, and a variable number of them, so AFAIK
> > hooking with __getattr__ or __getattribute__ will not work, as you can
> > only get the method name with that.
>
> why not just return the bound method *object* (a callable), and let the
> caller call that as usual (see Terry's last example).
>
> (hint: x.foo() can be written f=getattr(x,"foo"); f())
>
>
> </F>

I can tell you from my experience that this works; I've used this
before to make something very much like this proxy-class:

class RequestCalculations(object):
    def __init__(self, request):
        self.serviceType, self.facade =
makeMessageFacadeInstance(request)
        return

    def __getattr__(self, name):
        return getattr(self.facade, name)
    
(rest of the code omitted)

Cheers,

--Tim

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to