[docs] [issue19933] Round default argument for "ndigits"
report at bugs.python.org
Mon Dec 9 05:24:20 CET 2013
New submission from João Bernardo:
>From the docs for built-in function "round":
"If ndigits is omitted, it defaults to zero"
But, the only way to get an integer from `round` is by not having the second argument (ndigits):
>>> round(3.5, 1)
>>> round(3.5, 0)
>>> round(3.5, -1)
>>> round(3.5, None)
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
TypeError: 'NoneType' object cannot be interpreted as an integer
Either the docs are wrong or the behavior is wrong. I think it's easier to fix the former...
But also there should be a way to make round return an integer (e.g. passing `None` as 2nd argument)
assignee: docs at python
components: Documentation, Interpreter Core
nosy: JBernardo, docs at python
title: Round default argument for "ndigits"
versions: Python 3.4
Python tracker <report at bugs.python.org>
More information about the docs