[Python-3000-checkins] r64634 - in python/branches/py3k: Doc/library/functions.rst Python/bltinmodule.c

georg.brandl python-3000-checkins at python.org
Tue Jul 1 22:40:00 CEST 2008


Author: georg.brandl
Date: Tue Jul  1 22:39:59 2008
New Revision: 64634

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


Modified:
   python/branches/py3k/Doc/library/functions.rst
   python/branches/py3k/Python/bltinmodule.c

Modified: python/branches/py3k/Doc/library/functions.rst
==============================================================================
--- python/branches/py3k/Doc/library/functions.rst	(original)
+++ python/branches/py3k/Doc/library/functions.rst	Tue Jul  1 22:39:59 2008
@@ -964,11 +964,15 @@
 .. 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])

Modified: python/branches/py3k/Python/bltinmodule.c
==============================================================================
--- python/branches/py3k/Python/bltinmodule.c	(original)
+++ python/branches/py3k/Python/bltinmodule.c	Tue Jul  1 22:39:59 2008
@@ -1726,8 +1726,8 @@
 "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 *


More information about the Python-3000-checkins mailing list