Issue 6519: Reorder 'with' statement for files in Python Tutorial (original) (raw)

Created on 2009-07-19 01:19 by jjalocha, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
issue6519.txt akuchling,2016-11-06 19:44 review
Pull Requests
URL Status Linked Edit
PR 2143 merged akuchling,2017-06-13 01:11
PR 2145 merged Mariatta,2017-06-13 05:36
PR 2146 merged Mariatta,2017-06-13 05:36
Messages (10)
msg90698 - (view) Author: Jerzy Jalocha N (jjalocha) Date: 2009-07-19 01:19
Actually, the Python Tutorial recommends the use of the 'with' statement in Section 7.2.1. "Methods of File Objects": > It is good practice to use the with keyword when dealing with file > objects. [etc.] But the example and description are at the very bottom of this very large section, and are easily missed by new Python users. If this suggestion is to be taken seriously, I suggest putting this information at a more prominent place, somewhere at the top of the short section 7.2. "Reading and Writing Files".
msg100179 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2010-02-27 09:48
All the examples there assume that "a file object called f has already been created". Using a 'with' there it's not a good idea because the users will have to keep the instructions indented under the 'with'. However I agree that it would be better to move that example earlier. Maybe in 7.2 both the forms can be shown and discussed briefly.
msg280167 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2016-11-06 19:44
Good suggestion -- here's a patch that moves it and rewrites a little.
msg280208 - (view) Author: Berker Peksag (berker.peksag) * (Python committer) Date: 2016-11-07 16:41
The patch looks good to me. I think we can tweak the content a bit. I left some comments on Rietveld. Thanks!
msg295825 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2017-06-12 20:43
@akuchling Can you prepare a PR on GitHub?
msg295832 - (view) Author: A.M. Kuchling (akuchling) * (Python committer) Date: 2017-06-13 01:11
PR filed against master: https://github.com/python/cpython/pull/2143
msg295847 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2017-06-13 05:31
New changeset bd4e9e0ca96dabf33605d9b1fd1e0562ece8ae18 by Mariatta (Andrew Kuchling) in branch 'master': bpo-6519: Improve Python Input Output Tutorial (GH-2143) https://github.com/python/cpython/commit/bd4e9e0ca96dabf33605d9b1fd1e0562ece8ae18
msg295848 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2017-06-13 05:40
New changeset 81c05ccc10d044584dff3a69ee531094ed76ee2c by Mariatta in branch '3.6': bpo-6519: Improve Python Input Output Tutorial (GH-2143) (GH-2145) https://github.com/python/cpython/commit/81c05ccc10d044584dff3a69ee531094ed76ee2c
msg295849 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2017-06-13 05:40
New changeset 5a86154a931083e6a9f9bdf9cc8b3bc33abb673d by Mariatta in branch '3.5': bpo-6519: Improve Python Input Output Tutorial (GH-2143) (GH-2146) https://github.com/python/cpython/commit/5a86154a931083e6a9f9bdf9cc8b3bc33abb673d
msg295850 - (view) Author: Mariatta (Mariatta) * (Python committer) Date: 2017-06-13 05:43
Thanks everyone! I merged the PR and backported to 3.6 and 3.5. There are a bunch of conflicts when trying to backport to 2.7, so I decided not to bother.
History
Date User Action Args
2022-04-11 14:56:51 admin set github: 50768
2017-06-13 05:43:24 Mariatta set status: open -> closedversions: - Python 2.7messages: + resolution: fixedstage: patch review -> resolved
2017-06-13 05:40:45 Mariatta set messages: +
2017-06-13 05:40:20 Mariatta set messages: +
2017-06-13 05:36:09 Mariatta set pull_requests: + <pull%5Frequest2196>
2017-06-13 05:36:02 Mariatta set pull_requests: + <pull%5Frequest2195>
2017-06-13 05:31:03 Mariatta set messages: +
2017-06-13 01:11:41 akuchling set messages: + pull_requests: + <pull%5Frequest2193>
2017-06-12 20:43:27 Mariatta set nosy: + Mariattamessages: +
2016-11-07 16:41:34 berker.peksag set versions: + Python 2.7
2016-11-07 16:41:11 berker.peksag set versions: + Python 3.5, Python 3.6, Python 3.7, - Python 2.7, Python 3.2, Python 3.3, Python 3.4nosy: + berker.peksagmessages: + stage: needs patch -> patch review
2016-11-06 19:44:51 akuchling set files: + issue6519.txtnosy: + akuchlingmessages: +
2012-09-26 17:12:32 ezio.melotti set nosy: + chris.jerdonekversions: + Python 3.3, Python 3.4, - Python 3.1
2010-10-29 10:07:21 admin set assignee: georg.brandl -> docs@python
2010-08-07 21:28:34 terry.reedy set versions: - Python 2.6
2010-02-27 09:48:49 ezio.melotti set stage: needs patchmessages: + versions: - Python 3.0
2009-08-10 11:49:32 ezio.melotti set priority: lownosy: + ezio.melotti
2009-07-19 01:19:28 jjalocha create