[Python-3000] iostack, second revision
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Fri Sep 8 11:17:36 CEST 2006
"tomer filiba" <tomerfiliba at gmail.com> writes:
> yes, this was discussed some time ago. we concluded that the new
> position property should behave similar to negative indexes:
>
> f.position = 5 -- absolute seek, from the beginning of the stream
> f.position += 3 -- relative seek (*)
> f.position = -1 -- absolute seeking, back from the end (**)
Seeking to the very end requires a special constant, otherwise
it's off by 1.
I don't understand so strong desire to push that syntax despite
its problems with implementing += in one syscall and with specifying
the end point. If it doesn't work well, don't do it that way.
Of course magic constants are bad. My language Kogut has three
separate functions for seeking, it's simpler than interpreting
non-negative and negative numbers differently (and it can even seek
past the end if the OS supports that). I can't imagine a case where
the origin of seeking is not known statically.
--
__("< Marcin Kowalczyk
\__/ qrczak at knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/
More information about the Python-3000
mailing list