python file API
Thomas Rachel
nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa915 at spamschutz.glglgl.de
Tue Sep 25 15:40:49 EDT 2012
Am 25.09.2012 09:28 schrieb Steven D'Aprano:
>> The whole concept is incomplete at one place: self.seek(10, 2) seeks
>> beyond EOF, potentially creating a sparse file. This is a thing you
>> cannot achieve.
>
> On the contrary, since the pos attribute is just a wrapper around seek,
> you can seek beyond EOF easily:
>
> f.pos = None
> f.pos += 10
Yes, from a syscall perspective, it is different: it is a tell()
combined with a seek set instead of a relative seek. As someone
mentionned, e. g. in the case of a streamer tape this might make a big
difference.
> But for anything but the most trivial usage, I would recommend sticking
> to the seek method.
ACK. This should be kept as a fallback.
> ... or we need multiple attributes, one for each mode ...
Yes. That's what I would favourize: 3 attributes which each take a value
to be passed to seek.
> So all up, I'm -1 on trying to replace the tell/seek API, and -0 on
> adding a second, redundant API.
ACK.
Thomas
More information about the Python-list
mailing list