Commits

yasirs  committed ecdd0de

numpy.sort and doctest for sort

  • Participants
  • Parent commits e688491

Comments (0)

Files changed (2)

File pypy/module/micronumpy/app_numpy.py

 def mean(a):
     if not hasattr(a, "mean"):
         a = numpy.array(a)
-    return a.mean()
+    return a.mean()
+
+def sorted(a):
+	"""
+    Return a sorted copy of an array.
+    
+    sorted_array = numpy.sort(a)
+
+    Parameters
+    ----------
+    a : array_like
+        Array to be sorted.
+    
+    Returns
+    -------
+    sorted_array : numpy.array
+        Array of the same type and shape as `a`.
+    
+    See Also
+    --------
+    numpy.array.sort : Method to sort an array in-place.
+"""
+
+	b = numpy.array(a)
+	b.sort()
+	return b

File pypy/module/micronumpy/interp_numarray.py

     descr_argmin = _reduce_argmax_argmin_impl(minimum)
 
     def descr_sort(self, space):
+	"""
+numpy.array.sort()
+sorts the array in-place using the quicksort algorithm.
+	"""
         size = self.find_size()
 	stack = [(0,size-1)]
 	first=0; last=size-1; splitpoint=first;