[issue2406] Improvement suggestions for the gzip module documentation
Jakub Kadlčík added the comment: Hello, I think the example code snippets are awesome and no doubts, they helped me a lot. The only problem is that they are not idiomatic. They look like C more than Python. I suggest following patch -- nosy: +FrostyX Added file: http://bugs.python.org/file39790/idiomatic-gzip.diff ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2406 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2406] Improvement suggestions for the gzip module documentation
Ned Deily added the comment: Jakub, thanks for your suggested changes. But this issue was closed and the documentation updated many years ago. Please open a new issue with your suggested changes, otherwise they will likely be forgotten and ignored. -- nosy: +ned.deily ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2406 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2406] Improvement suggestions for the gzip module documentation
Georg Brandl [EMAIL PROTECTED] added the comment: Committed patch in r61999. Thanks! -- resolution: - accepted status: open - closed __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2406 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2406] Improvement suggestions for the gzip module documentation
Guilherme Polo [EMAIL PROTECTED] added the comment: Hello, (some comments) What about using gzip.open instead of GzipFile ? It is just a shorthand, but I prefer it (just my opinion). Also, remove those semicolons. At the second example you called close on the string object, I guess you intended to do file_obj.close() In the third example you used file, please change that to open. In this sample example, you don't need to use shutil. I suggest changing it to: import gzip f_in = open('/home/joe/file.txt', 'rb') f_out = gzip.open('/home/joe/file.txt.gz', 'wb'); f_out.writelines(f_in) file_obj_out.close() f_out.close() Finally, consider doing these changes against Doc/library/gzip.rst and sending the diff -- nosy: +gpolo __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2406 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2406] Improvement suggestions for the gzip module documentation
M.-A. DARCHE [EMAIL PROTECTED] added the comment: Thanks Guilherme (I hope Guilherme is your first name) for your very constructive answer. I'll do exactly as you suggest. Regards __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2406 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2406] Improvement suggestions for the gzip module documentation
M.-A. DARCHE [EMAIL PROTECTED] added the comment: Here is the diff of the suggested modifications, which include Guilherme remarks. This is the kind of doc I would have like to read when I needed it. Regards. -- keywords: +patch Added file: http://bugs.python.org/file9876/gzip.rst.diff __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2406 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2406] Improvement suggestions for the gzip module documentation
Guilherme Polo [EMAIL PROTECTED] added the comment: If I could I would commit it, but you have my support on this one nevertheless ;) __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2406 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue2406] Improvement suggestions for the gzip module documentation
New submission from M.-A. DARCHE [EMAIL PROTECTED]: The documentation for the gzip python module as found at http://docs.python.org/lib/module-gzip.html could be improved by code examples. Those examples are really lacking. Here below are the code snippets I propose. This is inspired by http://xahlee.org/perl-python/python_doc_gzip.html but done with respect and with another useful (I think) example. # Example of how to decompress a file import gzip file_obj = gzip.GzipFile('/home/joe/file.txt.gz', 'rb'); file_content = file_obj.read() file_obj.close() # Example of how to create a compressed GZIP file import gzip file_content = Lots of content here file_obj = gzip.GzipFile('/home/joe/file.txt.gz', 'wb'); file_obj.write(file_content) file_content.close() # Example of how to compress an existing file import shutil import gzip file_obj_in = file('/home/joe/file.txt', 'rb') file_obj_out = gzip.GzipFile('/home/joe/file.txt.gz', 'wb'); shutil.copyfileobj(file_obj_in, file_obj_out) file_obj_out.close() Best regards. -- assignee: georg.brandl components: Documentation messages: 63981 nosy: georg.brandl, madarche severity: normal status: open title: Improvement suggestions for the gzip module documentation __ Tracker [EMAIL PROTECTED] http://bugs.python.org/issue2406 __ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com