python file API

Oscar Benjamin oscar.j.benjamin at gmail.com
Tue Sep 25 05:58:25 EDT 2012


On Sep 25, 2012 9:28 AM, "Dennis Lee Bieber" <wlfraed at ix.netcom.com> wrote:
>
> On Tue, 25 Sep 2012 08:22:05 +0200, Ulrich Eckhardt
> <ulrich.eckhardt at dominolaser.com> declaimed the following in
> gmane.comp.python.general:
>
> > Am 24.09.2012 23:49, schrieb Dave Angel:
> > > And what approach would you use for positioning relative to
> > > end-of-file?  That's currently done with an optional second
> >  > parameter to seek() method.
> >
> > Negative indices.
> >
>
>         Which still doesn't handle the third seek mode -- relative to
> current position.

f.pos += delta

That's the only part of the proposal that I really think is an improvement
over the current method:

f.seek(delta, 1)

I actually had to google the whence code for relative seeking which I
wouldn't need to do if it were more descriptive.

But then I never do relative seeking. I'm pretty sure my programs have
always either read the whole file in order with no seeking or used random
access with absolute seeking.

Oscar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20120925/701ab98b/attachment.html>


More information about the Python-list mailing list