[Python-checkins] r82051 - python/branches/py3k/Doc/whatsnew/3.0.rst

mark.dickinson python-checkins at python.org
Thu Jun 17 20:24:52 CEST 2010


Author: mark.dickinson
Date: Thu Jun 17 20:24:52 2010
New Revision: 82051

Log:
Add note about changes to the `round` function between 2.x and 3.x.


Modified:
   python/branches/py3k/Doc/whatsnew/3.0.rst

Modified: python/branches/py3k/Doc/whatsnew/3.0.rst
==============================================================================
--- python/branches/py3k/Doc/whatsnew/3.0.rst	(original)
+++ python/branches/py3k/Doc/whatsnew/3.0.rst	Thu Jun 17 20:24:52 2010
@@ -798,6 +798,15 @@
 * A new built-in function :func:`next` was added to call the
   :meth:`__next__` method on an object.
 
+* The :func:`round` function rounding strategy and return type have
+  changed.  Exact halfway cases are now rounded to the nearest even
+  result instead of away from zero.  (For example, ``round(2.5)`` now
+  returns ``2`` rather than ``3``.)  :func:`round(x[, n])` now
+  delegates to ``x.__round__([n])`` instead of always returning a
+  float.  It generally returns an integer when called with a single
+  argument and a value of the same type as ``x`` when called with two
+  arguments.
+
 * Moved :func:`intern` to :func:`sys.intern`.
 
 * Removed: :func:`apply`.  Instead of ``apply(f, args)`` use


More information about the Python-checkins mailing list