[Python-ideas] file API
ironfroggy at gmail.com
Thu Sep 27 23:45:11 CEST 2012
On Thu, Sep 27, 2012 at 4:00 PM, Guido van Rossum <guido at python.org> wrote:
> Also you can't express lseek()'s "relative to end of file" mode using
> the proposed API. -1 on the whole thing.
You could use negative indexes, which is consistent with subscript and
slice interfaces. I still don't know that this is a good idea, but I'm
If someone wants a more sequence-like interface to files, they should use mmap
> On Thu, Sep 27, 2012 at 12:40 PM, Jim Jewett <jimjjewett at gmail.com> wrote:
>> On 9/24/12, Mark Adam <dreamingforward at gmail.com> wrote:
>>> For some time now, I've wanted to suggest a better abstraction for the
>>> <file> type in Python. It currently uses an antiquated, low-level
>>> C-style interface for moving around in a file, with methods like
>>> tell() and seek().
>> I agree, but I'm not sure the improvement can be *enough* of an
>> improvement to justify the cost of change.
>>>>>> file.pos = x0ae1 #move file pointer to an absolute address
>>>>>> file.pos += 1 #increment the file pointer one byte
>> For text files, I would expect it to be a character count rather than
>> a byte count. So this particular proposal might end up adding as much
>> confusion as it hopes to remove.
>> Python-ideas mailing list
>> Python-ideas at python.org
> --Guido van Rossum (python.org/~guido)
> Python-ideas mailing list
> Python-ideas at python.org
Read my blog! I depend on your acceptance of my opinion! I am interesting!
Follow me if you're into that sort of thing: http://www.twitter.com/ironfroggy
More information about the Python-ideas