Christopher J. Bottaro wrote:
> Kent Johnson wrote:
>>class C(object):
>>    @in_try
>>    def func_a(self):
>>        print "func_a"
>>        
>>    @in_try
>>    def func_b(self):
>>        print "func_b"
>>        raise Exception
>>
>>You could probably create a metaclass to apply the wrappers automatically
>>but I like having it explicit as above.
> 
> Another good solution, thank you.  Maybe a reason to upgrade to 2.4...=)

If you can't upgrade, you can write Kent's code like:

class C(object):
    def func_a(self):
        print "func_a"
    func_a = in_try(func_a)

    def func_b(self):
        print "func_b"
        raise Exception
    func_b = in_try(func_b)

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

Reply via email to