class based exceptions

Bruce Edge bedge at troikanetworks.com
Tue Apr 24 12:58:52 EDT 2001


In article <eShF6.9372$4N4.2100678 at newsc.telia.net>, "Fredrik Lundh"
<fredrik at pythonware.com> wrote:

> Bruce Edge wrote:
>> Can one associate an exception handler with all member functions of a
>> class without explicitly coding it in every member?
> 
> how about:
> 
>> class wrap:
>>   def __init__(self):
>>     self.resolve()
>>
>>   def resolve(self)
>>     #resolve corba reference
> 
>     def do(self, func, args):
>         try:
>             return apply(func, args)
>         except omniORB.CORBA.COMM_FAILURE
>             self.resolve()
>             return apply(func, args)
> 
>     def read(self, ...)
>         return self.do(corba.read, (...))
> 
>     def write(self, ...)
>         return self.do(corba.write, (...))
> 
> Cheers /F
> 
> 

Hey good idea, that works for me. Thanks.

-Bruce.



More information about the Python-list mailing list