[New-bugs-announce] [issue15078] Change os.sendfile so its arguments are stable
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.
title: Change os.sendfile so its arguments are stable
versions: Python 3.3
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce