Peter Otten wrote:
> try:
>     <operation that may fail>
> except <Error I can handle>:
>    <fix it>
> else:
>     <build on successful operation>
> 
> When you move the else suite into the try...except
> 
> try:
>     <operation that may fail>
>     <build on successful operation> #
> except <Error I can handle>:
>    <fix it>

Note that in general the semantics of these are different,
since in the first version the except clause will only catch
exceptions in <operation that may fail>, whereas in the
second it may catch exceptions in <build on successful operation>
as well.

It probably doesn't make a difference in this example, but
there are situations where it can.

--
Greg
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to