[New-bugs-announce] [issue15985] round() has wrong argument names

Chris Jerdonek report at bugs.python.org
Thu Sep 20 18:47:53 CEST 2012


New submission from Chris Jerdonek:

The documentation for round() says:

round(x[, n])
Return the floating point value x rounded to n digits after the decimal point. If n is omitted, it defaults to zero. Delegates to x.__round__(n).

(from http://docs.python.org/dev/library/functions.html#round )

However, we have the following:

Python 3.3.0rc2+ (default:1704deb7e6d7+, Sep 16 2012, 04:49:45) 
>>> round(x=4.7)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: Required argument 'number' (pos 1) not found
>>> round(number=4.7)
5

The second argument is also affected:

>>> round(5.1234, n=3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'n' is an invalid keyword argument for this function
>>> round(5.1234, ndigits=3)
5.123

----------
assignee: docs at python
components: Documentation
keywords: easy
messages: 170822
nosy: cjerdonek, docs at python
priority: normal
severity: normal
stage: needs patch
status: open
title: round() has wrong argument names
type: behavior
versions: Python 2.7, Python 3.2, Python 3.3

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


More information about the New-bugs-announce mailing list