[Python-Dev] Fuzziness in io module specs - PEP update proposition V2

Guido van Rossum guido at python.org
Mon Sep 28 19:33:21 CEST 2009


On Sun, Sep 27, 2009 at 3:44 PM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Le Sun, 27 Sep 2009 14:24:52 -0700, Guido van Rossum a écrit :
> [truncate()]
>>
>> What compatibility, though?
>
> Compatibility accross the 3.x line.

Well, in this case, maybe compatibility with 2.x is more important --
this isn't something we can easily warn about in 2.6+. In addition
there's the POSIX rules.

>> f.truncate() behaves different in 2.x than
>> in 3.x, and in 2.x it seems to match the POSIX semantics (i.e. the seek
>> position is unchanged even though the file size is). Perhaps the changed
>> semantics was an oversight or a mistake?
>
> Perhaps it was, indeed. I don't know who made that decision in the first
> place.

It might well have been me (when implementing the earliest version of
io.py), and I might well have *though* that I implemented the same
rules as 2.x, and never bothered to check. :-(

All in all I think we should change this before it's too late; it will
affect a very small number of apps (perhaps none?), but I would rather
have the right semantics in the future. Also, it's trivial to write
code that doesn't care (in fact code running under 2.x and 3.x
probably will have to be written so that it doesn't care) so it's not
like changing this is going to make life harder for people wanting
multiple-version support.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list