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.

Author serhiy.storchaka
Recipients lukasz.langa, rhettinger, serhiy.storchaka
Date 2021-08-27.03:16:59
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1630034219.48.0.907649008024.issue45026@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-08-27 03:16:59serhiy.storchakasetrecipients: + serhiy.storchaka, rhettinger, lukasz.langa
2021-08-27 03:16:59serhiy.storchakasetmessageid: <1630034219.48.0.907649008024.issue45026@roundup.psfhosted.org>
2021-08-27 03:16:59serhiy.storchakalinkissue45026 messages
2021-08-27 03:16:59serhiy.storchakacreate