[Python-3000] iostack, second revision
Guido van Rossum
guido at python.org
Fri Sep 8 18:37:13 CEST 2006
On 9/8/06, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Le jeudi 07 septembre 2006 à 16:33 -0700, Guido van Rossum a écrit :
> > Why not use tell() and seek() instead of get_pointer() and
> > set_pointer()? Seek should also support several special cases:
> > f.seek(0) seeks to the start of the file no matter what type is
> > otherwise used for pointers ("seek cookies" ?), f.seek(0, 1) is a
> > no-op, f.seek(0, 2) seeks to EOF.
>
> Perhaps it would be good to drop those magic numbers (0, 1, 2) for
> seek() ? They don't really help readibility except perhaps for people
> who still do a lot of C ;)
Maybe (since I fall in that category it doesn't bother me :-), but we
shouldn't replace them with symbolic constants. Having to import
another module to import names like SEEK_CUR and SEEK_END is not
Pythonic. Perhaps the seek() method can grow keyword arguments to
indicate the different types of seekage, or there should be three
separate methods.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list