[Tutor] Calling a Method with a Reserved Name

Kent Johnson kent37 at tds.net
Wed Oct 24 21:10:25 CEST 2007


Alex Ezell wrote:
>> You could try introspection:
>>
>> importFunc = getattr(self.soap, 'import')
>> self.call_response = importFunc(self.soap_auth, file_name,
>> import_groups, soap_flags)
> 
> Thanks Kent. I tried it and it seem like importFunc is now something
> like 'import.__str__'. I could maybe do some string operations to just
> get import out of that, but is there something I could do with
> getattr() for that reference to come back the way I need.

I guess you will have to dig into the implementation of the client a bit 
and find out what self.soap.import does and duplicate that somehow. What 
client code are you using? I would look for a __getattr__ method in the 
class implementing self.soap, for starters.

Kent


More information about the Tutor mailing list