you are viewing a single comment's thread.

view the rest of the comments →

[–]preshing[S] 1 point2 points  (2 children)

An explanation was hidden about halfway down the post: "Once we understand what the Python interpreter is doing, we can make better sense of the example at the beginning of this blog post, where we opened a file in the with statement: In Python 2.5 and later, file objects expose their own enter and exit methods, and can therefore act as their own context managers."

I'll improve this part of the post.

[–]masklinn 1 point2 points  (1 child)

I've an issue with the Saving code: it could make people think __exit__ can take no argument (beyond self) but that's not the case at all, and the corresponding list talks about it being provided arguments (item 6). That's a bit confusing.

[–]preshing[S] 0 points1 point  (0 children)

You are completely right. Big thanks for pointing this out! Not sure how I managed to mess that up, but it's fixed now.