# [Numpy-svn] r8203 - in trunk/numpy/lib: . tests

numpy-svn@scip... numpy-svn@scip...
Sat Feb 20 20:47:31 CST 2010

```Author: ptvirtan
Date: 2010-02-20 20:47:31 -0600 (Sat, 20 Feb 2010)
New Revision: 8203

Modified:
trunk/numpy/lib/polynomial.py
trunk/numpy/lib/tests/test_polynomial.py
Log:
3K: lib: poly1d __div__ -> __truediv__, and fix its doctests

Modified: trunk/numpy/lib/polynomial.py
===================================================================
--- trunk/numpy/lib/polynomial.py	2010-02-21 02:47:14 UTC (rev 8202)
+++ trunk/numpy/lib/polynomial.py	2010-02-21 02:47:31 UTC (rev 8203)
@@ -1147,6 +1147,8 @@
other = poly1d(other)
return polydiv(self, other)

+    __truediv__ = __div__
+
def __rdiv__(self, other):
if isscalar(other):
return poly1d(other/self.coeffs)

Modified: trunk/numpy/lib/tests/test_polynomial.py
===================================================================
--- trunk/numpy/lib/tests/test_polynomial.py	2010-02-21 02:47:14 UTC (rev 8202)
+++ trunk/numpy/lib/tests/test_polynomial.py	2010-02-21 02:47:31 UTC (rev 8203)
@@ -5,22 +5,22 @@
>>> p = poly1d([1.,2,3])
>>> p
poly1d([ 1.,  2.,  3.])
->>> print p
+>>> print(p)
2
1 x + 2 x + 3
>>> q = poly1d([3.,2,1])
>>> q
poly1d([ 3.,  2.,  1.])
->>> print q
+>>> print(q)
2
3 x + 2 x + 1
->>> print poly1d([1.89999+2j, -3j, -5.12345678, 2+1j])
+>>> print(poly1d([1.89999+2j, -3j, -5.12345678, 2+1j]))
3      2
(1.9 + 2j) x - 3j x - 5.123 x + (2 + 1j)
->>> print poly1d([100e-90, 1.234567e-9j+3, -1234.999e8])
+>>> print(poly1d([100e-90, 1.234567e-9j+3, -1234.999e8]))
2
1e-88 x + (3 + 1.235e-09j) x - 1.235e+11
->>> print poly1d([-3, -2, -1])
+>>> print(poly1d([-3, -2, -1]))
2
-3 x - 2 x - 1

@@ -70,11 +70,11 @@
poly1d([ 2.])

>>> q = poly1d([1.,2,3], variable='y')
->>> print q
+>>> print(q)
2
1 y + 2 y + 3
>>> q = poly1d([1.,2,3], variable='lambda')
->>> print q
+>>> print(q)
2
1 lambda + 2 lambda + 3

```