On Sat, Aug 20, 2016 at 4:28 PM, Alexander Heger <pyt...@2sn.net> wrote:
> Yes, I am aware it will cause a lot of backward incompatibilities...

Tell me, would you retain the ability to subscript a string to get its
characters?

>>> "asdf"[0]
'a'

If not, you break a ton of code. If you do, they are automatically
iterable *by definition*. Watch:

class IsThisIterable:
    def __getitem__(self, idx):
        if idx < 5: return idx*idx
        raise IndexError

>>> iti = IsThisIterable()
>>> for x in iti: print(x)
...
0
1
4
9
16

So you can't lose iteration without also losing subscripting.

ChrisA
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to