On Mon, 24 Feb 2020 at 16:23, Alex Hall <alex.moj...@gmail.com> wrote: > Roughly, though I think you might be hearing me wrong. There is lots of > existing code that correctly and intentionally iterates over strings. And > code that unintentionally does it probably doesn't live for long. But if you > took a random sample of all the times that someone has written code that > creates new behaviour which iterates over a string, most of them would be > mistakes. And essentially the developer was 'wrong' in those instances. In my > case, since I can't think of when I've needed to iterate over a string, I've > probably been wrong at least 90% of the time.
Conversely, I can't remember a case where I've ever accidentally iterated over a string when I meant not to. I *can* remember many times when I've relied on strings being iterable. Me quoting my experience is neither more nor less valuable than you quoting yours. However, mine aligns with the current behaviour of Python, and keeping things as they are so that my experience doesn't change has no backward compatibility implications. So I don't need to justify a preference that the language does what suits me best :-) I don't think (I haven't checked the thread closely) that anyone is saying your experience/expectation is "wrong". But to be sufficient to result in a change in the language, you have to establish that your behaviour is significantly *better* than the status quo, and I don't think that you're doing that at the moment. And IMO, you're never likely to do so simply by quoting numbers of people who do or don't prefer the current behaviour - compelling arguments are typically around demonstrating how much code would be demonstrably better with the new behaviour, along with showing that code that is detrimentally affected has an easy workaround. Your `.chars()` proposal targets the latter question, but neither you, nor anyone else in past iterations of this discussion, have yet come up with anything persuasive for the former, that I'm aware of. Paul _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/SZ3JB5LJEBOUHUZUUAH4KE7AIPTW563K/ Code of Conduct: http://python.org/psf/codeofconduct/