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.

classification
Title: gzip doc is behind
Type: enhancement Stage:
Components: Documentation Versions: Python 2.7
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: docs@python Nosy List: adam.woodbeck, docs@python, eric.araujo, pitrou, teamnoir
Priority: normal Keywords:

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:12adminsetgithub: 55412
2011-06-09 11:47:52eric.araujosetmessages: + msg137952
2011-06-07 21:54:02teamnoirsetstatus: open -> closed
resolution: wont fix
messages: + msg137886
2011-06-07 17:46:59teamnoirsetmessages: + msg137869
2011-06-07 17:41:47eric.araujosetmessages: + msg137867
2011-06-07 17:38:56teamnoirsetmessages: + msg137865
2011-06-07 17:25:52eric.araujosetmessages: + msg137863
2011-06-07 17:07:30teamnoirsetmessages: + msg137857
2011-06-07 16:56:34eric.araujosetmessages: + msg137852
2011-06-07 11:38:03pitrousetnosy: + pitrou

messages: + msg137811
versions: - Python 3.1, Python 3.2, Python 3.3
2011-05-28 13:17:23adam.woodbecksetnosy: + adam.woodbeck
2011-02-18 17:58:50eric.araujosetnosy: + eric.araujo

messages: + msg128798
versions: + Python 3.1, Python 3.2
2011-02-12 19:40:31teamnoircreate