summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorHameer Abbasi <einstein.edison@gmail.com>2020-04-10 20:19:36 +0200
committerGitHub <noreply@github.com>2020-04-10 13:19:36 -0500
commit1f3650643f341af8ca5c12529a479d73d3103895 (patch)
tree11ba7e500599d4aab078d8cb21b5c5f9e02ebe4e /doc
parent42228fcb513c08729f822fa6be70e16a7a68067f (diff)
downloadnumpy-1f3650643f341af8ca5c12529a479d73d3103895.tar.gz
BUG,DEP: Make `scalar.__round__()` behave like pythons round (#15840)
See issue gh-15297 and related mailing list discussion. This PR bring scalar.__round__() in line with python, so that `round(scalar)` always returns a python integer, while `round(scalar, ndigits=0)` returns the same type. Since complex numbers are not supported in Python, and cannot be reasonably cast to integers they are deprecated. Closes gh-15297
Diffstat (limited to 'doc')
-rw-r--r--doc/release/upcoming_changes/15840.compatibility.rst7
-rw-r--r--doc/release/upcoming_changes/15840.deprecation.rst6
2 files changed, 13 insertions, 0 deletions
diff --git a/doc/release/upcoming_changes/15840.compatibility.rst b/doc/release/upcoming_changes/15840.compatibility.rst
new file mode 100644
index 000000000..2709f133d
--- /dev/null
+++ b/doc/release/upcoming_changes/15840.compatibility.rst
@@ -0,0 +1,7 @@
+Change output of ``round`` on scalars to be consistent with Python
+------------------------------------------------------------------
+
+Output of the ``__round__`` dunder method and consequently the Python
+built-in `round` has been changed to be a Python `int` to be consistent
+with calling it on Python ``float`` objects when called with no arguments.
+Previously, it would return a scalar of the `np.dtype` that was passed in.
diff --git a/doc/release/upcoming_changes/15840.deprecation.rst b/doc/release/upcoming_changes/15840.deprecation.rst
new file mode 100644
index 000000000..cfcfecdb1
--- /dev/null
+++ b/doc/release/upcoming_changes/15840.deprecation.rst
@@ -0,0 +1,6 @@
+Deprecation of `round` for ``np.complexfloating`` scalars
+-----------------------------------------------------------
+
+Output of the ``__round__`` dunder method and consequently the Python built-in
+`round` has been deprecated on complex scalars. This does not affect
+`np.round`. \ No newline at end of file