[pypy-commit] pypy numpypy-axisops: reindent the docstring

fijal noreply at buildbot.pypy.org
Wed Jan 11 21:37:42 CET 2012


Author: Maciej Fijalkowski <fijall at gmail.com>
Branch: numpypy-axisops
Changeset: r51247:b906cc4a9740
Date: 2012-01-11 22:17 +0200
http://bitbucket.org/pypy/pypy/changeset/b906cc4a9740/

Log:	reindent the docstring

diff --git a/pypy/module/micronumpy/interp_ufuncs.py b/pypy/module/micronumpy/interp_ufuncs.py
--- a/pypy/module/micronumpy/interp_ufuncs.py
+++ b/pypy/module/micronumpy/interp_ufuncs.py
@@ -50,58 +50,58 @@
         return self.call(space, __args__.arguments_w)
 
     def descr_reduce(self, space, w_obj, w_dim=0):
-        '''reduce(...)
-    reduce(a, axis=0)
+        """reduce(...)
+        reduce(a, axis=0)
 
-    Reduces `a`'s dimension by one, by applying ufunc along one axis.
+        Reduces `a`'s dimension by one, by applying ufunc along one axis.
 
-    Let :math:`a.shape = (N_0, ..., N_i, ..., N_{M-1})`.  Then
-    :math:`ufunc.reduce(a, axis=i)[k_0, ..,k_{i-1}, k_{i+1}, .., k_{M-1}]` =
-    the result of iterating `j` over :math:`range(N_i)`, cumulatively applying
-    ufunc to each :math:`a[k_0, ..,k_{i-1}, j, k_{i+1}, .., k_{M-1}]`.
-    For a one-dimensional array, reduce produces results equivalent to:
-    ::
+        Let :math:`a.shape = (N_0, ..., N_i, ..., N_{M-1})`.  Then
+        :math:`ufunc.reduce(a, axis=i)[k_0, ..,k_{i-1}, k_{i+1}, .., k_{M-1}]` =
+        the result of iterating `j` over :math:`range(N_i)`, cumulatively applying
+        ufunc to each :math:`a[k_0, ..,k_{i-1}, j, k_{i+1}, .., k_{M-1}]`.
+        For a one-dimensional array, reduce produces results equivalent to:
+        ::
 
-     r = op.identity # op = ufunc
-     for i in xrange(len(A)):
-       r = op(r, A[i])
-     return r
+         r = op.identity # op = ufunc
+         for i in xrange(len(A)):
+           r = op(r, A[i])
+         return r
 
-    For example, add.reduce() is equivalent to sum().
+        For example, add.reduce() is equivalent to sum().
 
-    Parameters
-    ----------
-    a : array_like
-        The array to act on.
-    axis : int, optional
-        The axis along which to apply the reduction.
+        Parameters
+        ----------
+        a : array_like
+            The array to act on.
+        axis : int, optional
+            The axis along which to apply the reduction.
 
-    Examples
-    --------
-    >>> np.multiply.reduce([2,3,5])
-    30
+        Examples
+        --------
+        >>> np.multiply.reduce([2,3,5])
+        30
 
-    A multi-dimensional array example:
+        A multi-dimensional array example:
 
-    >>> X = np.arange(8).reshape((2,2,2))
-    >>> X
-    array([[[0, 1],
-            [2, 3]],
-           [[4, 5],
-            [6, 7]]])
-    >>> np.add.reduce(X, 0)
-    array([[ 4,  6],
-           [ 8, 10]])
-    >>> np.add.reduce(X) # confirm: default axis value is 0
-    array([[ 4,  6],
-           [ 8, 10]])
-    >>> np.add.reduce(X, 1)
-    array([[ 2,  4],
-           [10, 12]])
-    >>> np.add.reduce(X, 2)
-    array([[ 1,  5],
-           [ 9, 13]])
-    '''
+        >>> X = np.arange(8).reshape((2,2,2))
+        >>> X
+        array([[[0, 1],
+                [2, 3]],
+               [[4, 5],
+                [6, 7]]])
+        >>> np.add.reduce(X, 0)
+        array([[ 4,  6],
+               [ 8, 10]])
+        >>> np.add.reduce(X) # confirm: default axis value is 0
+        array([[ 4,  6],
+               [ 8, 10]])
+        >>> np.add.reduce(X, 1)
+        array([[ 2,  4],
+               [10, 12]])
+        >>> np.add.reduce(X, 2)
+        array([[ 1,  5],
+               [ 9, 13]])
+        """
         return self.reduce(space, w_obj, False, False, w_dim)
 
     def reduce(self, space, w_obj, multidim, promote_to_largest, w_dim):


More information about the pypy-commit mailing list