[Python-ideas] Add a `dir_fd` parameter to `os.truncate`?
steve at pearwood.info
Thu Apr 25 04:20:52 EDT 2019
On Fri, Apr 19, 2019 at 09:49:54PM +0200, Sebastian M. Ernst wrote:
> Hi everyone,
> many methods in `os` have a `dir_fd` parameter, for instance `unlink` :
> os.unlink(path, *, dir_fd=None)
> The `dir_fd` parameter  allows it to describe paths relative to
> directory descriptors. Otherwise, relative paths are relative to the
> current working directory.
> The implementation of `truncate` in `os` does not have this parameter :
> os.truncate(path, length)
> Why not add a convenience function or wrapper like above to the `os`
> module, which closes this gap and is more consistent with other methods?
I haven't seen any responses to your proposal, perhaps I missed
The os module is supposed to be a thin wrapper around the os
functionality, but your wrapper seems thin enough that I think it could
and should just go into the os.truncate function itself, rather than
adding a new function.
More information about the Python-ideas