Guy Taylor added the comment:
@Brandl truncate() was the issue I ran into, no other reason. I have started on
the rest of the IO module tho. I know the patch is not working but I ran into
problems with getting cpython to change functions from positional to keyword.
@all
cpython
Guy Taylor added the comment:
Sorry had not refreshed the page to pick up the last comment. After reading
more the cpython code I get what you are saying now. Not a fan of that syntax
but consistency is best.
This is my first time working with cpython directly, I have only worked on
small
Guy Taylor added the comment:
Looking through cpython and trying to form a patch I found several differing
interpretations of truncate:
Lib/_pyio.py
def truncate(self, pos=None):
Modules/_io/fileio.c
PyDoc_STRVAR(truncate_doc, "truncate([size: int]) ...");
A first semi-workin
Guy Taylor added the comment:
@murray The thing I would be worried at in both supporting truncate(0) and
truncate(size=0) would be truncate(0, size=1). This could throw an exception
but causes the need for extra sanity checks and introduces ambiguity in the
otherwise 'only one way
Guy Taylor added the comment:
What ever change is made to the new CPythons the old docs should be updated to
prevent confusion, with truncate([size]).
On fixing it for the future I would agree that supporting it as a keyword
argument is preferred, as it is more pythonic (in my opinion
New submission from Guy Taylor :
The Python docs suggest that io.IOBase.truncate' should take a keyword argument
of 'size'.
However this causes a 'TypeError':
TypeError: truncate() takes no keyword arguments
Suggest that the docs are changed to 'truncate(s