Terry J. Reedy added the comment:

I presume you are suggesting to raise if the length changes.  This is similar 
to raising when a dict is mutated while iterating.  Note that we do not do this 
with mutable sequences.  (If the iteration is stopped with out-of-memory error, 
so be it.)

An alternate approach would be to first fully evaluate start, stop, step , *and 
then length*, to ints, in that order, before using any of them.  In particular, 
have everything stable before comparing and adjusting start and stop to length. 
 This way, slices would continue to always work, barring other exceptions in 
__index__ or __length__.

----------
nosy: +terry.reedy

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

Reply via email to