Message400392
Currently the range iterator contains four integers: index, start, step and len. On iteration index is increased until achieve len, the result is calculated as start+index*step.
In the proposed PR the range iterator contains only three integers: index was removed. Instead len counts the number of iterations that left, and start is increased by step on every iteration. Less memory, simpler calculation.
Pickle no longer contains index, but __setstate__ is kept for compatibility.
The only incompatible change is that calling __setstate__ repeatedly will have different effect. Currently __setstate__ with the same values does not have effect, with this PR it will advance iterator. But Python only calls __setstate__ once for just created object when unpickle or copy. |
|
Date |
User |
Action |
Args |
2021-08-27 03:16:59 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, lukasz.langa |
2021-08-27 03:16:59 | serhiy.storchaka | set | messageid: <1630034219.48.0.907649008024.issue45026@roundup.psfhosted.org> |
2021-08-27 03:16:59 | serhiy.storchaka | link | issue45026 messages |
2021-08-27 03:16:59 | serhiy.storchaka | create | |
|