Terry J. Reedy added the comment: 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'}. ---------- nosy: +terry.reedy _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19933> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com