From 3aba37af52a67a6d56644d2d4fecb272211f6e5c Mon Sep 17 00:00:00 2001 From: Georg Brandl Date: Sun, 25 Apr 2010 10:20:56 +0000 Subject: Merged revisions 80463 via svnmerge from svn+ssh://svn.python.org/python/branches/py3k ................ r80463 | georg.brandl | 2010-04-25 12:19:53 +0200 (So, 25 Apr 2010) | 17 lines Merged revisions 80150,80460-80461 via svnmerge from svn+ssh://pythondev@svn.python.org/python/trunk ........ r80150 | r.david.murray | 2010-04-17 17:45:38 +0200 (Sa, 17 Apr 2010) | 2 lines Update link to Apple Publication Style guide. ........ r80460 | georg.brandl | 2010-04-25 12:16:00 +0200 (So, 25 Apr 2010) | 1 line #8528: fix typo. ........ r80461 | georg.brandl | 2010-04-25 12:17:27 +0200 (So, 25 Apr 2010) | 1 line #8522: use with statement instead of try-finally for file handling. ........ ................ --- Doc/documenting/style.rst | 2 +- Doc/howto/doanddont.rst | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/Doc/documenting/style.rst b/Doc/documenting/style.rst index 593f6da..6145559 100644 --- a/Doc/documenting/style.rst +++ b/Doc/documenting/style.rst @@ -66,5 +66,5 @@ Unix 1970s. -.. _Apple Publications Style Guide: http://developer.apple.com/documentation/UserExperience/Conceptual/APStyleGuide/APSG_2008.pdf +.. _Apple Publications Style Guide: http://developer.apple.com/mac/library/documentation/UserExperience/Conceptual/APStyleGuide/APSG_2009.pdf diff --git a/Doc/howto/doanddont.rst b/Doc/howto/doanddont.rst index 989ae9f..5fe3015 100644 --- a/Doc/howto/doanddont.rst +++ b/Doc/howto/doanddont.rst @@ -199,11 +199,8 @@ file would not be closed when an exception is raised until the handler finishes, and perhaps not at all in non-C implementations (e.g., Jython). :: def get_status(file): - fp = open(file) - try: + with open(file) as fp: return fp.readline() - finally: - fp.close() Using the Batteries -- cgit v0.12