This issue tracker has been migrated to GitHub ,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2011年10月23日 22:32 by carlo.verre, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Files | ||||
|---|---|---|---|---|
| File name | Uploaded | Description | Edit | |
| decumulate.py | carlo.verre, 2011年10月23日 22:32 | |||
| Messages (4) | |||
|---|---|---|---|
| msg146263 - (view) | Author: Carlo Verre (carlo.verre) | Date: 2011年10月23日 22:32 | |
After in Python 3.2 the accumulate() function has been added to itertools module, for self-evident reasons of completeness and symmetry we could add in 3.3 the inverse decumulate() function, which, given the iterable argument p, yields p[0], p[1] - p[0], p[2] - p[1]... Its equivalent python form is in the attached file decumulate.py, below. |
|||
| msg146290 - (view) | Author: Alyssa Coghlan (ncoghlan) * (Python committer) | Date: 2011年10月24日 10:45 | |
OK, looking at the code I realised what you're trying to get at is the idea of reporting the differences between values in a series, such that: x = list(accumulate(seq)) assert x == list(accumulate(differences(x))) I don't think the use cases are there to justify the addition (not every iterator we can think of should be a building block in itertools), but if such a thing were to be added, "differences" would convey the intention significantly better than the invented term "decumulate". |
|||
| msg166167 - (view) | Author: Ezio Melotti (ezio.melotti) * (Python committer) | Date: 2012年07月22日 20:29 | |
I don't think this should go in itertools. It could go in the recipes at the bottom of the itertools doc, if you can provide some valid use cases (and possibly a patch too). |
|||
| msg168260 - (view) | Author: Raymond Hettinger (rhettinger) * (Python committer) | Date: 2012年08月15日 05:40 | |
I also agree that the itertools module doesn't need this. (Reasons of "symmetry" are insufficient to make the module fatter that it already is). In addition, there are already a number of simple ways to do this. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:23 | admin | set | github: 57461 |
| 2012年08月15日 05:40:23 | rhettinger | set | status: open -> closed resolution: rejected messages: + msg168260 |
| 2012年07月23日 04:33:01 | rhettinger | set | priority: normal -> low assignee: rhettinger |
| 2012年07月22日 20:29:18 | ezio.melotti | set | versions:
+ Python 3.4, - Python 3.3 nosy: + ezio.melotti messages: + msg166167 stage: needs patch |
| 2011年10月24日 10:45:04 | ncoghlan | set | nosy:
+ ncoghlan messages: + msg146290 |
| 2011年10月24日 06:46:54 | petri.lehtinen | set | nosy:
+ petri.lehtinen |
| 2011年10月23日 22:32:47 | carlo.verre | create | |