This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年02月12日 19:40 by teamnoir, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (11) | |||
|---|---|---|---|
| msg128460 - (view) | Author: K Richard Pixley (teamnoir) | Date: 2011年02月12日 19:40 | |
The documentation for gzip should include the "close" method. It's use in the 2.7 documentation implies it's existence but it should also be stated explicitly that it exists. In the 3.x documentation, the use of "close" not in the examples since the examples use context manager. For 3.x documentation there should be both an explicit mention of the "close" method as well as an explicit mention that GzipFile supports the context manager protocol. Yes, the use of the context manager in the examples implies that this is true but documentation on other modules states so explicitly so this module should too. |
|||
| msg128798 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年02月18日 17:58 | |
Thanks for the report. Would you like to propose a patch? |
|||
| msg137811 - (view) | Author: Antoine Pitrou (pitrou) * (Python committer) | Date: 2011年06月07日 11:38 | |
The 3.x doc states that "GzipFile supports the io.BufferedIOBase interface, including iteration and the with statement. Only the truncate() method isn’t implemented". This implies that it also supports close(). |
|||
| msg137852 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年06月07日 16:56 | |
> This implies that it also supports close(). One has to follow the link to BufferedIOBase and then to IOBase, but I think it’s okay. Richard: Does that address your issue? |
|||
| msg137857 - (view) | Author: K Richard Pixley (teamnoir) | Date: 2011年06月07日 17:07 | |
My point was for python-2.7. I haven't stumbled into the buffer protocol yet. So no, it doesn't really. I still think the documentation, especially the 2.7 doc, could be more explicit. My concern here is with the use of close() becoming obscure, a second class citizen, or an afterthought. While I greatly appreciate the context manager, there are times when I want an enduring open channel for which the context manager just isn't appropriate. Even in a world with context manager, open and close need to be available and presented as a pair. It isn't clear to me from reading the doc or looking at the examples that gzip is expected to support a close call. Yes, I concur that there is an implication, but I would prefer to see it stated explicitly along with the explicit statement that it supports an open call. |
|||
| msg137863 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年06月07日 17:25 | |
In 2.7, while there is no index-generating entry for the close method, it is mentioned: "Calling a GzipFile object’s close() method [...]". > Yes, I concur that there is an implication, but I would prefer to see > it stated explicitly along with the explicit statement that it > supports an open call. I wouldn’t like to see the docs for int, float, complex, Decimal, Fraction, GzipFile, BZ2File, BytesIO, StringIO and all others having duplicated lists of methods and attributes that are already documented in the doc of the ABC. |
|||
| msg137865 - (view) | Author: K Richard Pixley (teamnoir) | Date: 2011年06月07日 17:38 | |
An interesting point, although I think that's only relevant if the documentation lists the ABC and a reference to it. (python-3 doc essentially does this.) I see no such reference in the 2.7 gzipfile doc, which leads me to believe, (from the doc alone), that it's an independent implementation of a "file like object". This may not be important enough to even merit the time we've already put into it. Please feel free to close this ticket without change if you prefer. |
|||
| msg137867 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年06月07日 17:41 | |
> I see no such reference in the 2.7 gzipfile doc Did you miss the first part of my previous message? The 2.7 docs for GzipFile do not link to the ABC, but they mention the close method in plain text. |
|||
| msg137869 - (view) | Author: K Richard Pixley (teamnoir) | Date: 2011年06月07日 17:46 | |
I didn't miss it. I think the close call needs equal treatment to the open call. The mention is certainly present, but seems implicit to me. I would prefer to see it listed explicitly. But I also don't think it's important enough in the 2.7 docs to discuss it much further. You've convinced me that it's not worth fixing. Let's drop it. |
|||
| msg137886 - (view) | Author: K Richard Pixley (teamnoir) | Date: 2011年06月07日 21:54 | |
I'm now convinced this isn't worth fixing in 2.x. |
|||
| msg137952 - (view) | Author: Éric Araujo (eric.araujo) * (Python committer) | Date: 2011年06月09日 11:47 | |
Just one thing: > I think the close call needs equal treatment to the open call. The open call is a module-level functions; the close method of GzipFile cannot be equally treated, as it is in the doc of the class, where no methods are given special treatment :) |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:12 | admin | set | github: 55412 |
| 2011年06月09日 11:47:52 | eric.araujo | set | messages: + msg137952 |
| 2011年06月07日 21:54:02 | teamnoir | set | status: open -> closed resolution: wont fix messages: + msg137886 |
| 2011年06月07日 17:46:59 | teamnoir | set | messages: + msg137869 |
| 2011年06月07日 17:41:47 | eric.araujo | set | messages: + msg137867 |
| 2011年06月07日 17:38:56 | teamnoir | set | messages: + msg137865 |
| 2011年06月07日 17:25:52 | eric.araujo | set | messages: + msg137863 |
| 2011年06月07日 17:07:30 | teamnoir | set | messages: + msg137857 |
| 2011年06月07日 16:56:34 | eric.araujo | set | messages: + msg137852 |
| 2011年06月07日 11:38:03 | pitrou | set | nosy:
+ pitrou messages: + msg137811 versions: - Python 3.1, Python 3.2, Python 3.3 |
| 2011年05月28日 13:17:23 | adam.woodbeck | set | nosy:
+ adam.woodbeck |
| 2011年02月18日 17:58:50 | eric.araujo | set | nosy:
+ eric.araujo messages: + msg128798 versions: + Python 3.1, Python 3.2 |
| 2011年02月12日 19:40:31 | teamnoir | create | |