This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients JBernardo, docs@python, mark.dickinson, r.david.murray, terry.reedy, vajrasky
Date 2013-12-14.02:18:06
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1386987487.54.0.8494253872.issue19933@psf.upfronthosting.co.za>
In-reply-to
Content
The docstring is better than the current doc as it says that the default precision is 0, without calling that the default for ndigits.

''' round(number[, ndigits]) -> number
    
    Round a number to a given precision in decimal digits (default 0 digits).
    This returns an int when called with one argument, otherwise the
    same type as the number. ndigits may be negative.'''

---
Sidenote: To write round in Python, one could easily write

_sentinel = object
def round(number, ndigits=_sentinel):
  if ndigits is _sentinel: ...

which makes ndigits positional-or-keyword, and almost optional-with-no-default, as _sentinel is close enough to being a default that cannot be passed in. This is a standard idiom. One who was really picky about having no default could use
  def round(number, *args, **kwds): ...
and look for len(args) == 1 xor kwds.keys() == {'ndigits'}.
History
Date User Action Args
2013-12-14 02:18:07terry.reedysetrecipients: + terry.reedy, mark.dickinson, r.david.murray, docs@python, JBernardo, vajrasky
2013-12-14 02:18:07terry.reedysetmessageid: <1386987487.54.0.8494253872.issue19933@psf.upfronthosting.co.za>
2013-12-14 02:18:07terry.reedylinkissue19933 messages
2013-12-14 02:18:06terry.reedycreate