Peter Otten <__pete...@web.de>:

> Marko Rauhamaa wrote:
>
>> However, I think the real answer is that you shouldn't mix the "with"
>> construct with exception handling. Instead you should write:
>> 
>>    try:
>>        f = open("xyz")
>>    except FileNotFoundError:
>>        ...[B]...
>>    try:
>>        ...[A]...
>>    finally:
>>        f.close()
>
> What's the problem with spelling the above
>
> try: 
>     f = open(...)
> except FileNotFoundError:
>     ...
> with f:
>     ...

Nothing.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to