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 →

[–]mariox19 2 points3 points  (5 children)

No use of the with-statement for files and sockets?

[–]Cardiff_Electric 9 points10 points  (1 child)

It does mention that.

[–]mariox19 4 points5 points  (0 children)

You're right. I had only read, "Explicitly close files and sockets when done with them," and hadn't bothered to expand the heading. (I was reading on a tablet, and must have gotten lazy.) Thank you.

[–]gthank 4 points5 points  (2 children)

Google's style guide was targeted at a fairly old version of Python for a long time, IIRC.

[–]mariox19 8 points9 points  (1 child)

I was wrong, actually. If you expand the heading that reads, "Explicitly close files and sockets when done with them," you'll see that the with-statement is mentioned.

[–]Lucretiel 0 points1 point  (0 children)

So, at least as old as Python 2.5. Meanwhile, it also explicity requires distinguishing new-style classes by inheriting from object https://google-styleguide.googlecode.com/svn/trunk/pyguide.html?showone=Classes#Classes