stripping the first byte from a binary file

Stefan Behnel stefan.behnel-n05pAM at web.de
Wed Jul 11 15:37:29 CEST 2007


Alex Popescu wrote:
> Forgive my newbie ignorance, but I am wondering why the other method
> would not work? I mean it may not be very safe,
> but I guess it may perform a lot better, than having to read the whole
> file just to cut out the first byte.

Why would you expect that? It *might* perform better if there was a system
call for removing bytes from inside a file, as that could reduce the
intermediate space requirements to the size of a hard disk sector rather than
the remaining size of the file (note that the time consumption would not be
reduced significantly, if the remaining file has to be copied around to fill
the sectors). But since that is a rather rare use case that most people would
prefer being handled in a safe rather than space-optimal way, I don't see the
need for such a function.

Stefan



More information about the Python-list mailing list