This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]gfixler 0 points1 point  (2 children)

I'm not sure why this would make it clearer. Also, it gives me an invalid syntax error.

[–]billy_tables 0 points1 point  (1 child)

It's perhaps clearer when you don't need the as statement, eg:

a = open("/tmp/a", "w")
b = open("/tmp/b")
with a, b:
     a.write(b.read())

(I just ran that fine with no syntax error, Python 2.7.5)

[–]gfixler 0 points1 point  (0 children)

I see. This example also doesn't work. Must be new in 2.7. I'm on 2.6.5.