[Python-ideas] str.startswith taking any iterator instead of just tuple

Eric Snow ericsnowcurrently at gmail.com
Sun Jan 5 18:49:26 CET 2014


On Jan 5, 2014 4:10 AM, "David Townshend" <aquavitae69 at gmail.com> wrote:
>
> Reading this thread made me start to think about why a string is a
sequence, and I can't actually see any obvious reason, other than
historical ones.

Sometimes I think it would be more clear if strings weren't sequences but
had various attributes that exposed sequence "views", e.g. codepoints,
etc.  Making strings non-sequences isn't realistic at this point, but
adding the sequence view attributes may still be nice.

That said, at present it's not something I personally have any use case
for.  There was an article floating around the web recently where the
deficiencies of unicode implementations was discussed and I recall
something there or in related discussions about use cases for having
different views into a string.  Wow that was vague. :)  The different views
into unicode strings certainly comes up from time to time on our lists.

-eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140105/5fdc86ae/attachment.html>


More information about the Python-ideas mailing list