# HG changeset patch
# User Florent Hivert <Florent.Hivert@univ-rouen.fr>
# Date 1321345415 -3600
# Node ID f901d81985378a3dd36776bfac1feb8640e12691
# Parent 70ef7738ff73d6eb8e6df1693f5f808b1ce25868
[mq]: list_speedup.patch
diff --git a/sage/structure/list_clone.pyx b/sage/structure/list_clone.pyx
|
a
|
b
|
AUTHORS: |
| 130 | 130 | |
| 131 | 131 | |
| 132 | 132 | include "../ext/stdsage.pxi" |
| | 133 | include "../ext/python_list.pxi" |
| | 134 | include "../ext/python_int.pxi" |
| | 135 | include "../ext/python_ref.pxi" |
| 133 | 136 | |
| 134 | 137 | import sage |
| 135 | 138 | from sage.structure.element cimport Element |
| … |
… |
cdef class ClonableIntArray(ClonableElem |
| 1449 | 1452 | False |
| 1450 | 1453 | sage: I.list() == range(5) |
| 1451 | 1454 | True |
| 1452 | | |
| | 1455 | sage: I = IncreasingIntArrays()(range(1000)) |
| | 1456 | sage: I.list() == range(1000) |
| | 1457 | True |
| 1453 | 1458 | """ |
| 1454 | 1459 | cdef int i |
| 1455 | | cdef list L = [] |
| | 1460 | cdef list L = <list> PyList_New(self._len) |
| | 1461 | cdef object o |
| 1456 | 1462 | for i from 0<=i<self._len: |
| 1457 | | L.append(self._list[i]) |
| | 1463 | o = PyInt_FromLong(self._list[i]) |
| | 1464 | Py_INCREF(o) |
| | 1465 | PyList_SET_ITEM(L, i, o) |
| 1458 | 1466 | return L |
| 1459 | 1467 | |
| 1460 | 1468 | def __getitem__(self, key): |