[New-bugs-announce] [issue5821] Documentation: mention 'close' and iteration for tarfile.TarFile.extractfile()

Ben North report at bugs.python.org
Thu Apr 23 15:03:09 CEST 2009

New submission from Ben North <bennorth at users.sourceforge.net>:

The current documentation for tarfile.TarFile.extractfile() does not
mention that the returned 'file-like object' supports close() and also
iteration.  The attached patch (against svn trunk) fixes this.

(Background: I was wondering whether I could write

  def process_and_close_file(f_in):
      with closing(f_in) as f:
          # Do stuff with f.

and have it work whether f_in was a true file or the return value of
extractfile(), and thought from the documentation that I couldn't.  Of
course, I could have just tried it, but I think fixing the documentation
wouldn't hurt.)

assignee: georg.brandl
components: Documentation
files: tarfile.rst.patch
keywords: patch
messages: 86366
nosy: bennorth, georg.brandl
severity: normal
status: open
title: Documentation: mention 'close' and iteration for tarfile.TarFile.extractfile()
type: feature request
Added file: http://bugs.python.org/file13749/tarfile.rst.patch

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list