[Python-Dev] Fuzziness in io module specs

Greg Ewing greg.ewing at canterbury.ac.nz
Sun Sep 20 03:11:53 CEST 2009


Steven D'Aprano wrote:

> Using "truncate" to mean "increase in size" makes about as much sense as 
> having a list method called "remove" used to insert items. I can't 
> imagine what the committee who approved this were thinking.

I expect the reason is historical. Some time back in the
early days of Unix, someone wanted a way of chopping back
files, so they added a truncate() system call. Then someone
else noticed that it would happily accept an argument greater
than the existing length, and it seemed like that could
be useful behaviour, so they documented it and left it that way.

Then the POSIX committee came along and incorporated it into
the standard so as to be compatible with existing practice.

-- 
Greg


More information about the Python-Dev mailing list