On 10 April 2013 22:17, eryksun <eryk...@gmail.com> wrote:
>
> But I think it's more readable to break up a long line like this:
>
>     fin = open('old.dat')
>     fout = open('new.dat', 'w')
>
>     with fin, fout:
>         for line in fin:

This has the same problems as contextlib.nested: An error raised while
opening 'new.dat' could prevent 'old.dat' from being closed properly.


Oscar
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to