templatetaizing exceptions

david asdrubale at gnx.it
Tue Nov 13 10:41:24 CET 2007


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



More information about the Python-list mailing list