There is no special syntax for this at the Python level. You must define the usual optional arguments and perform the validation yourself.
The specific case you are looking at is implemented in C. Depending on which platform you are running on, the implementation of C is different. Here is the version for POSIX, Windows and OS / 2:
static PyObject *
posix_fdopen(PyObject *self, PyObject *args)
{
...
if (!PyArg_ParseTuple(args, "i|si", &fd, &orgmode, &bufsize))
return NULL;
Use PyArg_ParseTuplemeans that this function does not actually accept any arguments by name. If you execute os.fdopen(sth, bufsize=16), you will get a TypeError:
>>> os.fdopen('', bufsize=16)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: fdopen() takes no keyword arguments
, , bufsize mode. , , , , . Python 1.3, Python, python.org, 1.4, os.fdopen .