From the source code for float_roundto floatobjects.cin 3.5:
float_round(PyObject *v, PyObject *args)
...
if (!PyArg_ParseTuple(args, "|O", &o_ndigits))
return NULL;
...
if (o_ndigits == NULL || o_ndigits == Py_None) {
...
|| o_ndigits == Py_None ndigits=None , round .
3.4 :
float_round(PyObject *v, PyObject *args)
...
if (!PyArg_ParseTuple(args, "|O", &o_ndigits))
return NULL;
...
if (o_ndigits == NULL) {
...
|| o_ndigits == Py_None , , ndgits=None int, TypeError round(1.0, None) 3.4.
o_ndigits == Py_None long_round longobject.c 3.4, 3.5, TypeError round(1, None) 3.4, 3.5
treat ndigits=None as resolve
Version/Type single-argument call round(n, None)
3.4/float No TypeError
3.4/long No TypeError
3.5/float Yes round(n)
3.5/long No TypeError