else in try/except

MRAB python at mrabarnett.plus.com
Mon Nov 14 17:59:35 EST 2011


On 14/11/2011 21:53, Ethan Furman wrote:
> The code in 'else' in a 'try/except/else[/finally]' block seems
> pointless to me, as I am not seeing any difference between having the
> code in the 'else' suite vs having the code in the 'try' suite.
>
> Can anybody shed some light on this for me?
>
The difference is that if an exception occurs in the else block it
won't be caught by the exception handlers of the try statement.



More information about the Python-list mailing list