[issue15078] Change os.sendfile so its arguments are stable

Larry Hastings report at bugs.python.org
Fri Jun 15 12:53:38 CEST 2012


New submission from Larry Hastings <larry at hastings.org>:

As I keep saying on python-dev: I think that the argument list for a function should be stable.  If you have a function where some abilities are only available on certain platforms, it's best to always accept default no-op parameters for those parameters, rather than adding and removing parameters based on what functionality is available.

os.sendfile() accepts either four or seven parameters, depending on the current platform.  However, it's a new function in trunk and therefore has no installed base.  So it's not too late to change it.

I propose to amend os.sendfile so it always accepts all seven arguments.  Its signature would therefore be the following, on all platforms:

os.sendfile(out, in, offset, nbytes, headers=None, trailers=None, flags=0)

Passing in a non-None value for headers or trailers, or a nonzero value for flags, on a platform where the seven-argument form of sendfile is not available would raise NotImplementedError.

----------
assignee: larry
messages: 162886
nosy: larry
priority: normal
severity: normal
status: open
title: Change os.sendfile so its arguments are stable
type: behavior
versions: Python 3.3

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15078>
_______________________________________


More information about the Python-bugs-list mailing list