[issue19933] Round default argument for "ndigits"

João Bernardo report at bugs.python.org
Mon Dec 9 15:14:09 CET 2013


João Bernardo added the comment:

> I don't understand.  There's already a way to make round return an integer: don't pass a second argument.

If this function were to be written in Python, it would be something like:

    def round(number, ndigits=0):
        ...

or 

    def round(number, ndigits=None):
        ...


But in C you can forge the signature to whatever you want and parse the arguments accordingly. In Python there's always a way to get the default behavior by passing the default argument, but in C it may not exist (in this case `PyObject *o_ndigits = NULL;`)

So, I propose the default value being `None`, so this behavior can be achieved using a second argument.

----------

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


More information about the Python-bugs-list mailing list