Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45026>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to