Timeline for Pythonic way to add each previous element in list
Current License: CC BY-SA 3.0
12 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Dec 9, 2016 at 17:38 | comment | added | wizzwizz4 | @Graipher No, arrays are always bumpy in Python. | |
| Dec 9, 2016 at 13:05 | comment | added | Graipher | numpy arrays, of course. | |
| Dec 9, 2016 at 11:55 | comment | added | Graipher | @Peilonrayz Good to know. Makes sense that it only starts to be faster when used on bumpy arrays | |
| Dec 9, 2016 at 10:42 | vote | accept | Natha | ||
| Dec 9, 2016 at 10:20 | vote | accept | Natha | ||
| Dec 9, 2016 at 10:42 | |||||
| Dec 9, 2016 at 10:17 | comment | added | Peilonrayz♦ |
BTW, list(itertools.accumulate(l)) is faster than numpy.cumsum(l). I only tried when l was a Python list, as that's the use-case.
|
|
| Dec 9, 2016 at 9:56 | history | edited | Graipher | CC BY-SA 3.0 |
added 54 characters in body
|
| Dec 9, 2016 at 9:50 | history | edited | Graipher | CC BY-SA 3.0 |
added 84 characters in body
|
| Dec 9, 2016 at 9:49 | comment | added | Graipher | @Peilonrayz I agree. This is why I proposed two non-numpy alternatives (where the generator is probably even better if the OP does not actually need the cumulative sums all at once). | |
| Dec 9, 2016 at 9:48 | comment | added | Peilonrayz♦ | Not everyone has, needs or wants to use NumPy. Let's not make it the JQuery to JavaScript questions of Stack Overflow. | |
| Dec 9, 2016 at 9:47 | history | edited | Graipher | CC BY-SA 3.0 |
added 56 characters in body
|
| Dec 9, 2016 at 9:41 | history | answered | Graipher | CC BY-SA 3.0 |