Q on explicitly calling file.close

Stephen Hansen apt.shansen at gmail.com
Sun Sep 6 13:34:12 EDT 2009


>
> It's just too bad that 'with' doesn't support multiple separate "x as y"
>> clauses.
>>
>
> The developers already agreed with you ;-).
>
> "With more than one item, the context managers are processed as if multiple
> with statements were nested:
>
> with A() as a, B() as b:
>    suite
> is equivalent to
>
> with A() as a:
>    with B() as b:
>        suite
> Changed in version 3.1: Support for multiple context expressions.
> "
>

Doh! I hadn't noticed that. Alas, I'm /just barely now/ moving to Python
2.5, I won't be able to even consider getting near Python 3 for -- a year or
so, I'm expecting. If ever!

(I suspect this will also be in 2.7)
>

Ah, that's a beacon of hope.

--S
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090906/a6898270/attachment-0001.html>


More information about the Python-list mailing list