summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormpro <magdalena.proszewska@gmail.com>2019-11-18 22:49:20 +0100
committermpro <magdalena.proszewska@gmail.com>2019-11-18 22:49:20 +0100
commitcef6aa3830f915f9589a50700670da062e6acffd (patch)
treecd588909066856eebcfe2c6ae84d0e78806ec414
parentab90c876b0fead1b923b1616f8f50a5fded83de6 (diff)
downloadnumpy-cef6aa3830f915f9589a50700670da062e6acffd.tar.gz
Apply proposed changes
-rw-r--r--numpy/core/_add_newdocs.py9
1 files changed, 3 insertions, 6 deletions
diff --git a/numpy/core/_add_newdocs.py b/numpy/core/_add_newdocs.py
index 2396437c1..4ddd59a72 100644
--- a/numpy/core/_add_newdocs.py
+++ b/numpy/core/_add_newdocs.py
@@ -3953,25 +3953,22 @@ add_newdoc('numpy.core.multiarray', 'ndarray', ('tolist',
Examples
--------
- For a 1D array, ``a.tolist()`` is almost the same as ``list(a)``, except that it changes numpy scalars to Python scalars:
+ For a 1D array, ``a.tolist()`` is almost the same as ``list(a)``,
+ except that ``tolist`` changes numpy scalars to Python scalars:
>>> a = np.uint32([1, 2])
>>> a_list = list(a)
>>> a_list
[1, 2]
- >>> type(a_list)
- <class 'list'>
>>> type(a_list[0])
<class 'numpy.uint32'>
>>> a_tolist = a.tolist()
>>> a_tolist
[1, 2]
- >>> type(a_tolist)
- <class 'list'>
>>> type(a_tolist[0])
<class 'int'>
- However, for a 2D array, ``tolist`` applies recursively:
+ Additionally, for a 2D array, ``tolist`` applies recursively:
>>> a = np.array([[1, 2], [3, 4]])
>>> list(a)