[Python-Dev] Fuzziness in io module specs

Pascal Chambon chambon.pascal at gmail.com
Sun Sep 20 09:16:27 CEST 2009


Well, system compatibility argues strongl in favor of not letting 
filepointer > EOF.
However, is that really necessary to move the pointer to EOF in ANY case 
? I mean, if I extend the file, or if I reduce it without going lower 
than my current filepointer, I really don't expect at all the io system 
to move my pointer to the end of file, "just for fun". In these 
patterns, people would have to remember their current filepointer, to 
come back to where they were, and that's not pretty imo...

If we agree on the simple mandatory expression 0 <= filepointer <= EOF 
(for cross-platform safety), then we just have to enforce it when the 
rule is broken : reducing the size lower than the filepointer, and 
seeking past the end of file. All other conditions should leav the 
filepointer where the user put it. Shouldnt it be so ?

   
Concerning the naming of truncate(), would it be possible to deprecate 
it and alias it to "resize()" ? It's not very gratifying to have 
duplicated methods at the beginning of a major release, but I feel too 
that "truncate" is a misleading term, that had better be replaced asap.

Regards,
Pascal


More information about the Python-Dev mailing list