templatetaizing exceptions

alf ask at me
Tue Nov 13 08:10:38 EST 2007


david wrote:
> On Tue, 13 Nov 2007 06:17:26 -0300, Gabriel Genellina wrote:
> 
>> A function?
>>
>>   	try:
>>   		code_block
>>   	except A:
>>   		handle_exception()
> 
> maybe
> 
>>>> def handle(f, *args, **kw):
> ...     try:
> ...             return f(*args, **kw)
> ...     except A:
> ...             handle_exception()
> 
>>>> def doSomething():
> ...    code_block
> ...
>>>> handle(doSomething)
> 
> cheers

thx - this might work ...

-- 
alfz1



More information about the Python-list mailing list