Re: __getattribute__ and methods proxying

2010-06-12 Thread Stephen Hansen
On 6/12/10 12:59 PM, Giampaolo Rodolà wrote: > Clear, thanks. > Isn't there a prettier/common way to do this? > A __methodcall__(self, method_obj) special method or something? Has > something like that ever been proposed for inclusion? Not really, because that doesn't actually fit into the object

Re: __getattribute__ and methods proxying

2010-06-12 Thread Thomas Jollans
On 06/12/2010 09:59 PM, Giampaolo Rodolà wrote: > 2010/6/12 David Zaslavsky : >> Hi, >> >> The problem is that when you make this call: >>> proc.cmdline() >> there are really two steps involved. First you are accessing proc.cmdline, >> then you are calling it. You could think of it as this: >> fun

Re: __getattribute__ and methods proxying

2010-06-12 Thread Giampaolo Rodolà
2010/6/12 David Zaslavsky : > Hi, > > The problem is that when you make this call: >> proc.cmdline() > there are really two steps involved. First you are accessing proc.cmdline, > then you are calling it. You could think of it as this: >  func = proc.cmdline >  func() > __getattribute__ is able to

Re: __getattribute__ and methods proxying

2010-06-12 Thread exarkun
On 07:01 pm, g.rod...@gmail.com wrote: Hi, I have a class which looks like the one below. What I'm trying to accomplish is to "wrap" all my method calls and attribute lookups into a "proxy" method which translates certain exceptions into others. The code below *apparently* works: the original met

Re: __getattribute__ and methods proxying

2010-06-12 Thread David Zaslavsky
Hi, The problem is that when you make this call: > proc.cmdline() there are really two steps involved. First you are accessing proc.cmdline, then you are calling it. You could think of it as this: func = proc.cmdline func() __getattribute__ is able to modify how the first step works, but not th

__getattribute__ and methods proxying

2010-06-12 Thread Giampaolo Rodolà
Hi, I have a class which looks like the one below. What I'm trying to accomplish is to "wrap" all my method calls and attribute lookups into a "proxy" method which translates certain exceptions into others. The code below *apparently* works: the original method is called but for some reason the "ex