From: Georg Brandl <georg@python.org>
Date: Tue, 1 Jul 2008 20:39:59 +0000 (+0000)
Subject: #3191: fix round() docs and docstring.
X-Git-Tag: v3.0b2~125
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=809ddaaafb9c08bcf42e1a9e93dd2f9f604bdd41;p=python

#3191: fix round() docs and docstring.
---

diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index a420974851..4b1cbc6615 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -964,11 +964,15 @@ are always available.  They are listed here in alphabetical order.
 .. function:: 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.  Values are rounded to the
+   point.  If *n* is omitted, it defaults to zero.  Delegates to
+   ``x.__round__(n)``.
+
+   For the built-in types supporting :func:`round`, values are rounded to the
    closest multiple of 10 to the power minus *n*; if two multiples are equally
    close, rounding is done toward the even choice (so, for example, both
-   ``round(0.5)`` and ``round(-0.5)`` are ``0``, and ``round(1.5)`` is
-   ``2``). Delegates to ``x.__round__(n)``.
+   ``round(0.5)`` and ``round(-0.5)`` are ``0``, and ``round(1.5)`` is ``2``).
+   The return value is an integer if called with one argument, otherwise of the
+   same type as *x*.
 
 
 .. function:: set([iterable])
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 35ba781be3..bd826f0a57 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -1726,8 +1726,8 @@ PyDoc_STRVAR(round_doc,
 "round(number[, ndigits]) -> floating point number\n\
 \n\
 Round a number to a given precision in decimal digits (default 0 digits).\n\
-This returns an int when called with one argument, otherwise a float.\n\
-Precision may be negative.");
+This returns an int when called with one argument, otherwise a the\n\
+same type as the number. ndigits may be negative.");
 
 
 static PyObject *