Steve D'Aprano <steve+pyt...@pearwood.info>:

> or you can let the context manager do what it does, and write your own code
> to do what you do:
>
> try:
>     with ...:
>        ...
> except:
>     ...

Even better:

    try:
       a = open(...)
    except ...:
       ...
    with a:
       ...

You want to catch exceptions immediately after (potentially) raising
them.


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

Reply via email to