[prev in list] [next in list] [prev in thread] [next in thread]
List: python-list
Subject: Re: python file API
From: Ramchandra Apte <maniandram01 () gmail ! com>
Date: 2012-09-30 12:50:52
Message-ID: b82cfda0-ee91-458c-8a1a-6a6dc8893cb4 () googlegroups ! com
[Download RAW message or body]
On Tuesday, 25 September 2012 03:05:16 UTC+5:30, zipher wrote:
> For some time now, I've wanted to suggest a better abstraction for the <file> type \
> in Python. It currently uses an antiquated C-style interface for moving around in \
> a file, with methods like tell() and seek(). But after attributes were introduced \
> to Python, it seems it should be re-addressed.
>
>
> Let file-type have an attribute .pos for position. Now you can get rid of the \
> seek() and tell() methods and manipulate the file pointer more easily with standard \
> arithmetic operations.
>
>
> > > > file.pos = x0ae1 #move file pointer to an absolute address
>
> > > > file.pos +=1 #increment the file pointer one byte
>
> > > > curr_pos = file.pos #read current file pointer
>
>
>
> You've now simplified the API by the removal of two obscure legacy methods and \
> replaced them with a more basic one called "position".
>
>
> Thoughts?
>
>
>
> markj
+1
--
http://mail.python.org/mailman/listinfo/python-list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic