templatetaizing exceptions

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Tue Nov 13 04:17:26 EST 2007


En Tue, 13 Nov 2007 01:09:12 -0300, alf <ask at me.xs4all.nl> escribió:

> I have a few places in the code where I use:
>
> 	try:
> 		code_block
> 	except A:
> 		exception_handling
>
>
> the code block is different each time while exception_handling the same.
>
> What would be the best technique to abstract that out?

A function?

  	try:
  		code_block
  	except A:
  		handle_exception()

-- 
Gabriel Genellina




More information about the Python-list mailing list