<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">> Yes, I am aware it will cause a lot of backward incompatibilities...<br>
<br>
Tell me, would you retain the ability to subscript a string to get its<br>
characters?<br>
<br>
>>> "asdf"[0]<br>
'a'<br>
<br>
If not, you break a ton of code. If you do, they are automatically<br>
iterable *by definition*. Watch:<br>
<br>
class IsThisIterable:<br>
    def __getitem__(self, idx):<br>
        if idx < 5: return idx*idx<br>
        raise IndexError<br>
<br>
>>> iti = IsThisIterable()<br>
>>> for x in iti: print(x)<br>
...<br>
0<br>
1<br>
4<br>
9<br>
16<br>
<br>
So you can't lose iteration without also losing subscripting.<br></blockquote><div><br></div><div>Python here does a lot of things implicitly.  I always felt the (explicit) index operator in strings in many other languages sort of is syntactic sugar, in python it was taken to do literally the same things as on other objects.  But it does not have to be that way.</div></div></div></div>