Python: Retorno en bloque try-except-finally
Bueno saberlo:
En Python se puede tener un bloque try-except-finally, retornar en except y aún así el código finally es ejecutado. Genial!
>>> def function(): ... try: ... raise Exception() ... except: ... return True ... finally: ... print 'Finally executed' ... >>> function() Finally executed True
Advertisement





Aún no hay trackbacks