[Python-ideas] discontinue iterable strings

Michael Selik michael.selik at gmail.com
Sat Aug 20 20:34:02 EDT 2016


On Sat, Aug 20, 2016 at 5:27 PM Alexander Heger <python at 2sn.net> wrote:

> - any code that subscripts, slices, or iterates over a str will break
>>
>
> I would try to keep indexing and slicing, but not iterating.
>

So anything that wants to loop over a string character by character would
need to construct a new object, like ``for c in list(s)``? That seems
inefficient. I suppose you might advocate for a new type, some sort of
stringview that would allow iteration over a string, but avoid allocating
so much space as a list does, but that might bring us back to where we
started.


> The fixes overall will be a lot easier and obvious than introduction of
> unicode as default string type in Python 3.0.
>

That's a bold claim. Have you considered what's at stake if that's not true?

Anyway, why don't you write a proof of concept module for a non-iterable
string, throw it on PyPI, and see if people like using it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160821/acfa4795/attachment.html>


More information about the Python-ideas mailing list