[Python-3000] iostack, second revision

Nick Coghlan ncoghlan at gmail.com
Sat Sep 9 07:44:59 CEST 2006


Jim Jewett wrote:
> On 9/8/06, Antoine Pitrou <solipsis at pitrou.net> wrote:
>> Le vendredi 08 septembre 2006 à 11:06 -0700, Guido van Rossum a écrit :
>>> -1 on those particular cryptic names. Which one of seekby() and
>>> rseek() is the relative seek? Where's the seek relative to EOF?
> 
>> What about seek(), seek_relative() and seek_reverse() ?
> 
> Why not just borrow the standard symbolic names of cur and end?
> 
>     seek(pos=0)
>     seek_cur(pos=0)
>     seek_end(pos=0)
> 
>     seek_end(-1000)    <==> 1000 units (bytes or chars or records or
> ...) before the end
>     seek_cur(50)          <==> 50 units beyond current
>     seek()                     <==> beginning

+1 here. Short, to the point, and easy to remember for anyone already familiar 
with seek().

Cheers,
Nick.

P.S. on a slightly different topic, it would be nice if f.seek(-1) raised 
ValueError instead of IOError. Passing a negative absolute seek value is a 
program bug, not an environment problem.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list