diff options
author | gfyoung <gfyoung17@gmail.com> | 2015-12-19 16:49:35 -0800 |
---|---|---|
committer | gfyoung <gfyoung17@gmail.com> | 2015-12-19 16:50:09 -0800 |
commit | 8bc592fabf4a2b0bc76db996b1523330ba095be3 (patch) | |
tree | c8a1a549e5a093a9433fe9a50a6e0e8bb5358ab1 /numpy/lib | |
parent | e2bdaccba1a8691f9223b059b981b2890bb13b09 (diff) | |
download | numpy-8bc592fabf4a2b0bc76db996b1523330ba095be3.tar.gz |
DOC: Use print only as function when print_function is imported from __future__
Closes gh-6863.
Diffstat (limited to 'numpy/lib')
-rw-r--r-- | numpy/lib/arrayterator.py | 4 | ||||
-rw-r--r-- | numpy/lib/financial.py | 4 | ||||
-rw-r--r-- | numpy/lib/function_base.py | 8 | ||||
-rw-r--r-- | numpy/lib/index_tricks.py | 4 | ||||
-rw-r--r-- | numpy/lib/polynomial.py | 16 | ||||
-rw-r--r-- | numpy/lib/tests/test_format.py | 2 | ||||
-rw-r--r-- | numpy/lib/twodim_base.py | 2 | ||||
-rw-r--r-- | numpy/lib/type_check.py | 2 |
8 files changed, 21 insertions, 21 deletions
diff --git a/numpy/lib/arrayterator.py b/numpy/lib/arrayterator.py index 80b369bd5..fb52ada86 100644 --- a/numpy/lib/arrayterator.py +++ b/numpy/lib/arrayterator.py @@ -80,7 +80,7 @@ class Arrayterator(object): >>> for subarr in a_itor: ... if not subarr.all(): - ... print subarr, subarr.shape + ... print(subarr, subarr.shape) ... [[[[0 1]]]] (1, 1, 1, 2) @@ -158,7 +158,7 @@ class Arrayterator(object): >>> for subarr in a_itor.flat: ... if not subarr: - ... print subarr, type(subarr) + ... print(subarr, type(subarr)) ... 0 <type 'numpy.int32'> diff --git a/numpy/lib/financial.py b/numpy/lib/financial.py index a7e4e60b6..c42424da1 100644 --- a/numpy/lib/financial.py +++ b/numpy/lib/financial.py @@ -247,7 +247,7 @@ def nper(rate, pmt, pv, fv=0, when='end'): If you only had $150/month to pay towards the loan, how long would it take to pay-off a loan of $8,000 at 7% annual interest? - >>> print round(np.nper(0.07/12, -150, 8000), 5) + >>> print(round(np.nper(0.07/12, -150, 8000), 5)) 64.07335 So, over 64 months would be required to pay off the loan. @@ -347,7 +347,7 @@ def ipmt(rate, per, nper, pv, fv=0.0, when='end'): >>> for payment in per: ... index = payment - 1 ... principal = principal + ppmt[index] - ... print fmt.format(payment, ppmt[index], ipmt[index], principal) + ... print(fmt.format(payment, ppmt[index], ipmt[index], principal)) 1 -200.58 -17.17 2299.42 2 -201.96 -15.79 2097.46 3 -203.35 -14.40 1894.11 diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 8335b4fdb..c69185c1c 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -833,7 +833,7 @@ def asarray_chkfinite(a, dtype=None, order=None): >>> try: ... np.asarray_chkfinite(a) ... except ValueError: - ... print 'ValueError' + ... print('ValueError') ... ValueError @@ -2200,13 +2200,13 @@ def cov(m, y=None, rowvar=True, bias=False, ddof=None, fweights=None, >>> x = [-2.1, -1, 4.3] >>> y = [3, 1.1, 0.12] >>> X = np.vstack((x,y)) - >>> print np.cov(X) + >>> print(np.cov(X)) [[ 11.71 -4.286 ] [ -4.286 2.14413333]] - >>> print np.cov(x, y) + >>> print(np.cov(x, y)) [[ 11.71 -4.286 ] [ -4.286 2.14413333]] - >>> print np.cov(x) + >>> print(np.cov(x)) 11.71 """ diff --git a/numpy/lib/index_tricks.py b/numpy/lib/index_tricks.py index 8bcc3fb53..a0875a25f 100644 --- a/numpy/lib/index_tricks.py +++ b/numpy/lib/index_tricks.py @@ -491,7 +491,7 @@ class ndenumerate(object): -------- >>> a = np.array([[1, 2], [3, 4]]) >>> for index, x in np.ndenumerate(a): - ... print index, x + ... print(index, x) (0, 0) 1 (0, 1) 2 (1, 0) 3 @@ -542,7 +542,7 @@ class ndindex(object): Examples -------- >>> for index in np.ndindex(3, 2, 1): - ... print index + ... print(index) (0, 0, 0) (0, 1, 0) (1, 0, 0) diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py index 2f677438b..a5d3f5f5f 100644 --- a/numpy/lib/polynomial.py +++ b/numpy/lib/polynomial.py @@ -715,12 +715,12 @@ def polyadd(a1, a2): >>> p1 = np.poly1d([1, 2]) >>> p2 = np.poly1d([9, 5, 4]) - >>> print p1 + >>> print(p1) 1 x + 2 - >>> print p2 + >>> print(p2) 2 9 x + 5 x + 4 - >>> print np.polyadd(p1, p2) + >>> print(np.polyadd(p1, p2)) 2 9 x + 6 x + 6 @@ -826,13 +826,13 @@ def polymul(a1, a2): >>> p1 = np.poly1d([1, 2, 3]) >>> p2 = np.poly1d([9, 5, 1]) - >>> print p1 + >>> print(p1) 2 1 x + 2 x + 3 - >>> print p2 + >>> print(p2) 2 9 x + 5 x + 1 - >>> print np.polymul(p1, p2) + >>> print(np.polymul(p1, p2)) 4 3 2 9 x + 23 x + 38 x + 17 x + 3 @@ -966,7 +966,7 @@ class poly1d(object): Construct the polynomial :math:`x^2 + 2x + 3`: >>> p = np.poly1d([1, 2, 3]) - >>> print np.poly1d(p) + >>> print(np.poly1d(p)) 2 1 x + 2 x + 3 @@ -1022,7 +1022,7 @@ class poly1d(object): using the `variable` parameter: >>> p = np.poly1d([1,2,3], variable='z') - >>> print p + >>> print(p) 2 1 z + 2 z + 3 diff --git a/numpy/lib/tests/test_format.py b/numpy/lib/tests/test_format.py index 1bf65fa61..a091ef5b3 100644 --- a/numpy/lib/tests/test_format.py +++ b/numpy/lib/tests/test_format.py @@ -112,7 +112,7 @@ Test the header writing. >>> for arr in basic_arrays + record_arrays: ... f = BytesIO() ... format.write_array_header_1_0(f, arr) # XXX: arr is not a dict, items gets called on it - ... print repr(f.getvalue()) + ... print(repr(f.getvalue())) ... "F\x00{'descr': '|u1', 'fortran_order': False, 'shape': (0,)} \n" "F\x00{'descr': '|u1', 'fortran_order': False, 'shape': ()} \n" diff --git a/numpy/lib/twodim_base.py b/numpy/lib/twodim_base.py index 464ffd914..b2f350bb7 100644 --- a/numpy/lib/twodim_base.py +++ b/numpy/lib/twodim_base.py @@ -664,7 +664,7 @@ def histogram2d(x, y, bins=10, range=None, normed=False, weights=None): Or we fill the histogram H with a determined bin content: >>> H = np.ones((4, 4)).cumsum().reshape(4, 4) - >>> print H[::-1] # This shows the bin content in the order as plotted + >>> print(H[::-1]) # This shows the bin content in the order as plotted [[ 13. 14. 15. 16.] [ 9. 10. 11. 12.] [ 5. 6. 7. 8.] diff --git a/numpy/lib/type_check.py b/numpy/lib/type_check.py index 2fe4e7d23..1313adff7 100644 --- a/numpy/lib/type_check.py +++ b/numpy/lib/type_check.py @@ -501,7 +501,7 @@ def typename(char): >>> typechars = ['S1', '?', 'B', 'D', 'G', 'F', 'I', 'H', 'L', 'O', 'Q', ... 'S', 'U', 'V', 'b', 'd', 'g', 'f', 'i', 'h', 'l', 'q'] >>> for typechar in typechars: - ... print typechar, ' : ', np.typename(typechar) + ... print(typechar, ' : ', np.typename(typechar)) ... S1 : character ? : bool |