Author: mattip <[email protected]>
Branch:
Changeset: r79863:403ce2521b92
Date: 2015-09-27 08:52 +0300
http://bitbucket.org/pypy/pypy/changeset/403ce2521b92/
Log: fix translation - closure -> class
diff --git a/pypy/module/micronumpy/concrete.py
b/pypy/module/micronumpy/concrete.py
--- a/pypy/module/micronumpy/concrete.py
+++ b/pypy/module/micronumpy/concrete.py
@@ -18,6 +18,19 @@
is_f_contiguous)
from rpython.rlib.objectmodel import keepalive_until_here
+TimSort = make_timsort_class()
+class StrideSort(TimSort):
+ '''
+ argsort (return the indices to sort) a list of strides
+ '''
+ def __init__(self, rangelist, strides):
+ self.strides = strides
+ TimSort.__init__(self, rangelist)
+
+ def lt(self, a, b):
+ return self.strides[a] < self.strides[b]
+
+
class BaseConcreteArray(object):
_immutable_fields_ = ['dtype?', 'storage', 'start', 'size', 'shape[*]',
'strides[*]', 'backstrides[*]', 'order', 'gcstruct',
@@ -355,11 +368,9 @@
elif order != self.order:
t_strides, backstrides = calc_strides(shape, dtype, order)
else:
- def arg_lt(a, b):
- return strides[a] < strides[b]
- ArgSort=make_timsort_class(lt=arg_lt)
indx_array = range(len(strides))
- ArgSort(indx_array).sort()
+ list_sorter = StrideSort(indx_array, strides)
+ list_sorter.sort()
t_elsize = dtype.elsize
t_strides = strides[:]
base = dtype.elsize
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit