jdveigaï¼ gmail.com wrote: > Kyle Stanley wrote: > > In order for this proposal to be seriously > > considered, I think it's > > necessary to cite many realistic examples where the current behavior is > > problematic enough to justify changing the current behavior, and that > > adding a str.chars() and eventually removing the ability to iterate over > > strings would provide a better fix than any existing solutions. Simply > > stating that much of the Python community considers the current behavior to > > be "somewhat problematic" based on previous suggestions is certainly not > > going to be adequately convincing, at least not to me. > > But, even in the case that we are able to conclude that the current > > behavior causes significant issues that can't be addressed as well with > > existing solutions, I strongly suspect that this is going to be the case of > > change that is far too fundamental to Python to be changed at this point, > > even with a distant deprecation warning and many years of advanced notice > > regarding the removal/change after that. > > I agree. I can barely imagine what is wrong with Python's strings. Can you > > please > provide any example? > It is a common "pattern" in any languages to walk along strings, letter by > letter. > Python's strings provide a powerful way of doing it --as a sequence which is > a fundamental > type in the language. No need to dealing with indexes, terminators, lengths, > boundaries, > etc. I love Python because of this and hate C's and Java's strings. > On the other hand, what about slices? Since slices operate in sequences and > lists, if > strings are not longer sequences, how would Python do slicing on strings > according to your > proposal? > I think strings as immutable strings is indeed a wise implementation decision > on > Python. > Thank you.
The only change I am proposing is that the iterability for characters in a string be moved from the string object itself to a view that is returned from a `chars()` method of the string. Eventually, direct iteratability would be deprecated and then removed. I do not want indexing behavior to be moved, removed, or altered, and I am not suggesting that it would/should be. _______________________________________________ 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/W6MSTUGA53HCNXEBIAM6Y2LBCGAKODMQ/ Code of Conduct: http://python.org/psf/codeofconduct/