[issue21146] update gzip usage examples in docs

2015-04-14 Thread Roundup Robot
Roundup Robot added the comment: New changeset ae1528beae67 by Andrew Kuchling in branch 'default': #21146: give a more efficient recipe in gzip docs https://hg.python.org/cpython/rev/ae1528beae67 -- nosy: +python-dev ___ Python tracker

[issue21146] update gzip usage examples in docs

2015-04-14 Thread A.M. Kuchling
Changes by A.M. Kuchling a...@amk.ca: -- resolution: - fixed stage: - resolved status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21146 ___

[issue21146] update gzip usage examples in docs

2015-04-14 Thread A.M. Kuchling
A.M. Kuchling added the comment: Applied to trunk. Wolfgang Maier: thanks for your patch! -- nosy: +akuchling ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21146 ___

[issue21146] update gzip usage examples in docs

2014-04-15 Thread Wolfgang Maier
Wolfgang Maier added the comment: well, buffering is not the issue here. It's that the file iterator used in the current example is line-based, so whatever the buffer size you're doing unnecessary inspection to find and split on line terminators. --

[issue21146] update gzip usage examples in docs

2014-04-14 Thread Matt Chaput
Matt Chaput added the comment: The patch looks good to me. -- nosy: +maatt ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue21146 ___ ___

[issue21146] update gzip usage examples in docs

2014-04-14 Thread Éric Araujo
Éric Araujo added the comment: Isn’t there a buffering argument in open that can be used to avoid line buffering? -- nosy: +eric.araujo versions: +Python 3.5 -Python 3.2, Python 3.3 ___ Python tracker rep...@bugs.python.org

[issue21146] update gzip usage examples in docs

2014-04-08 Thread Wolfgang Maier
Wolfgang Maier added the comment: ok, I've prepared the patch using the elegant shutil solution. -- keywords: +patch Added file: http://bugs.python.org/file34765/gzip_example_usage_patch.diff ___ Python tracker rep...@bugs.python.org

[issue21146] update gzip usage examples in docs

2014-04-03 Thread Wolfgang Maier
New submission from Wolfgang Maier: The current documentation of the gzip module should have its section 12.2.1. Examples of usage updated to reflect the changes made to the module in Python3.2 (https://docs.python.org/3.2/whatsnew/3.2.html#gzip-and-zipfile). Currently, the recipe given for

[issue21146] update gzip usage examples in docs

2014-04-03 Thread INADA Naoki
INADA Naoki added the comment: Maybe, shutil.copyfileobj() is good. import gzip import shutil with open(src, 'rb') as f_in: with gzip.open(dst, 'wb') as f_out: shutil.copyfileobj(f_in, f_out) -- nosy: +naoki ___ Python tracker

[issue21146] update gzip usage examples in docs

2014-04-03 Thread Wolfgang Maier
Wolfgang Maier added the comment: with open(src, 'rb') as f_in: with gzip.open(dst, 'wb') as f_out: shutil.copyfileobj(f_in, f_out) +1 !! exactly as fast as my suggestion (with compression and de-compression), but a lot clearer ! Hadn't thought of it. --

[issue21146] update gzip usage examples in docs

2014-04-03 Thread Wolfgang Maier
Wolfgang Maier added the comment: same speed is not surprising though as shutil.copyfileobj is implemented like this: def copyfileobj(fsrc, fdst, length=16*1024): copy data from file-like object fsrc to file-like object fdst while 1: buf = fsrc.read(length) if not buf: