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

Guido van Rossum guido at python.org
Sun Sep 27 23:24:52 CEST 2009

On Sun, Sep 27, 2009 at 4:33 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
>> So here is the proposed semantic, which matches established conventions:
>> *IOBase.truncate(n: int = None) -> int*
> [...]
> I still don't think there is a sufficient benefit in breaking
> compatibility. If you want the file pointer to remain the same, you can
> save it first and restore it afterwards manually.

What compatibility, though? 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?

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

More information about the Python-Dev mailing list