diff options
Diffstat (limited to 'numpy/core')
-rw-r--r-- | numpy/core/arrayprint.py | 8 | ||||
-rw-r--r-- | numpy/core/fromnumeric.py | 10 | ||||
-rw-r--r-- | numpy/core/numeric.py | 8 | ||||
-rw-r--r-- | numpy/core/numerictypes.py | 2 | ||||
-rw-r--r-- | numpy/core/records.py | 8 | ||||
-rw-r--r-- | numpy/core/shape_base.py | 2 |
6 files changed, 19 insertions, 19 deletions
diff --git a/numpy/core/arrayprint.py b/numpy/core/arrayprint.py index a28b5a89e..fefcb6493 100644 --- a/numpy/core/arrayprint.py +++ b/numpy/core/arrayprint.py @@ -114,13 +114,13 @@ def set_printoptions(precision=None, threshold=None, edgeitems=None, Floating point precision can be set: >>> np.set_printoptions(precision=4) - >>> print np.array([1.123456789]) + >>> print(np.array([1.123456789])) [ 1.1235] Long arrays can be summarised: >>> np.set_printoptions(threshold=5) - >>> print np.arange(10) + >>> print(np.arange(10)) [0 1 2 ..., 7 8 9] Small results can be suppressed: @@ -420,8 +420,8 @@ def array2string(a, max_line_width=None, precision=None, Examples -------- >>> x = np.array([1e-16,1,2,3]) - >>> print np.array2string(x, precision=2, separator=',', - ... suppress_small=True) + >>> print(np.array2string(x, precision=2, separator=',', + ... suppress_small=True)) [ 0., 1., 2., 3.] >>> x = np.arange(3.) diff --git a/numpy/core/fromnumeric.py b/numpy/core/fromnumeric.py index 197513294..7d2078adf 100644 --- a/numpy/core/fromnumeric.py +++ b/numpy/core/fromnumeric.py @@ -1434,20 +1434,20 @@ def ravel(a, order='C'): It is equivalent to ``reshape(-1, order=order)``. >>> x = np.array([[1, 2, 3], [4, 5, 6]]) - >>> print np.ravel(x) + >>> print(np.ravel(x)) [1 2 3 4 5 6] - >>> print x.reshape(-1) + >>> print(x.reshape(-1)) [1 2 3 4 5 6] - >>> print np.ravel(x, order='F') + >>> print(np.ravel(x, order='F')) [1 4 2 5 3 6] When ``order`` is 'A', it will preserve the array's 'C' or 'F' ordering: - >>> print np.ravel(x.T) + >>> print(np.ravel(x.T)) [1 4 2 5 3 6] - >>> print np.ravel(x.T, order='A') + >>> print(np.ravel(x.T, order='A')) [1 2 3 4 5 6] When ``order`` is 'K', it will preserve orderings that are neither 'C' diff --git a/numpy/core/numeric.py b/numpy/core/numeric.py index 3b442ea78..4f3d418e6 100644 --- a/numpy/core/numeric.py +++ b/numpy/core/numeric.py @@ -1808,7 +1808,7 @@ def set_string_function(f, repr=True): >>> a = np.arange(10) >>> a HA! - What are you going to do now? - >>> print a + >>> print(a) [0 1 2 3 4 5 6 7 8 9] We can reset the function to the default: @@ -2710,7 +2710,7 @@ def seterrcall(func): Callback upon error: >>> def err_handler(type, flag): - ... print "Floating point error (%s), with flag %s" % (type, flag) + ... print("Floating point error (%s), with flag %s" % (type, flag)) ... >>> saved_handler = np.seterrcall(err_handler) @@ -2729,7 +2729,7 @@ def seterrcall(func): >>> class Log(object): ... def write(self, msg): - ... print "LOG: %s" % msg + ... print("LOG: %s" % msg) ... >>> log = Log() @@ -2787,7 +2787,7 @@ def geterrcall(): >>> oldsettings = np.seterr(all='call') >>> def err_handler(type, flag): - ... print "Floating point error (%s), with flag %s" % (type, flag) + ... print("Floating point error (%s), with flag %s" % (type, flag)) >>> oldhandler = np.seterrcall(err_handler) >>> np.array([1, 2, 3]) / 0.0 Floating point error (divide by zero), with flag 1 diff --git a/numpy/core/numerictypes.py b/numpy/core/numerictypes.py index 7dc6e0bd8..1b6551e6c 100644 --- a/numpy/core/numerictypes.py +++ b/numpy/core/numerictypes.py @@ -822,7 +822,7 @@ def sctype2char(sctype): Examples -------- >>> for sctype in [np.int32, np.float, np.complex, np.string_, np.ndarray]: - ... print np.sctype2char(sctype) + ... print(np.sctype2char(sctype)) l d D diff --git a/numpy/core/records.py b/numpy/core/records.py index b07755384..ca6070cf7 100644 --- a/numpy/core/records.py +++ b/numpy/core/records.py @@ -567,7 +567,7 @@ def fromarrays(arrayList, dtype=None, shape=None, formats=None, >>> x2=np.array(['a','dd','xyz','12']) >>> x3=np.array([1.1,2,3,4]) >>> r = np.core.records.fromarrays([x1,x2,x3],names='a,b,c') - >>> print r[1] + >>> print(r[1]) (2, 'dd', 2.0) >>> x1[1]=34 >>> r.a @@ -643,7 +643,7 @@ def fromrecords(recList, dtype=None, shape=None, formats=None, names=None, >>> r=np.core.records.fromrecords([(456,'dbe',1.2),(2,'de',1.3)], ... names='col1,col2,col3') - >>> print r[0] + >>> print(r[0]) (456, 'dbe', 1.2) >>> r.col1 array([456, 2]) @@ -651,7 +651,7 @@ def fromrecords(recList, dtype=None, shape=None, formats=None, names=None, array(['dbe', 'de'], dtype='|S3') >>> import pickle - >>> print pickle.loads(pickle.dumps(r)) + >>> print(pickle.loads(pickle.dumps(r))) [(456, 'dbe', 1.2) (2, 'de', 1.3)] """ @@ -736,7 +736,7 @@ def fromfile(fd, dtype=None, shape=None, offset=0, formats=None, >>> fd.seek(0) >>> r=np.core.records.fromfile(fd, formats='f8,i4,a5', shape=10, ... byteorder='<') - >>> print r[5] + >>> print(r[5]) (0.5, 10, 'abcde') >>> r.shape (10,) diff --git a/numpy/core/shape_base.py b/numpy/core/shape_base.py index 0dd2e164a..599b48d82 100644 --- a/numpy/core/shape_base.py +++ b/numpy/core/shape_base.py @@ -150,7 +150,7 @@ def atleast_3d(*arys): True >>> for arr in np.atleast_3d([1, 2], [[1, 2]], [[[1, 2]]]): - ... print arr, arr.shape + ... print(arr, arr.shape) ... [[[1] [2]]] (1, 2, 1) |