[Patches] [ python-Patches-992750 ] zipfile and big zipped file

SourceForge.net noreply at sourceforge.net
Wed Aug 18 15:13:27 CEST 2004


Patches item #992750, was opened at 2004-07-17 09:45
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=992750&group_id=5470

Category: Library (Lib)
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Keyphrene (keyphrene)
Assigned to: Nobody/Anonymous (nobody)
Summary: zipfile and big zipped file

Initial Comment:
read method decompress the zipped files, but this
method returns bytes, more the file is big, more the
bytes array is big. readFile method allows to send the
bytes in a file.

----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2004-08-18 15:13

Message:
Logged In: YES 
user_id=21627

The patch is unacceptable in its current form. It duplicates
too much code; read and readfile should really share the
common code (e.g. by read falling back to readfile).

Also, as this really copies the data to fileobj, it probably
is better called copyfile, instead of readfile.

Finally, I would much prefer if zipfile would have an .open
method, returning a file-like object. Then you would have
such implementations

  def read(self, name):
      return self.open(name, "r").read()

  def readfile(self, name, dest):
      import shutil
      shutil.copyfileobj(self.open(name,"r"), dest)

I would then probably leave the last method out, and
encourage users to invoke shutil.copyfileobj directly if
desired.

Are you willing to make changes in this direction?

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=992750&group_id=5470


More information about the Patches mailing list