[issue40598] round() does not return an integer when given a numpy float64

STINNER Victor report at bugs.python.org
Mon May 11 18:30:56 EDT 2020


STINNER Victor <vstinner at python.org> added the comment:

> The round() helptext states "The return value is an integer if ndigits is omitted or None.  Otherwise the return value has the same type as the number."

round(number) is documented to call number.__round__:

https://docs.python.org/dev/library/functions.html#round
For a general Python object number, round delegates to number.__round__.

It's not a bug, Python works as expected.

It's better to refer to the main documentation. Docstrings are short and incomplete on purpose. I close the issue.

----------
nosy: +vstinner
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40598>
_______________________________________


More information about the Python-bugs-list mailing list