Greg Ewing wrote:
It is a common "pattern" in any languages to walk along strings, letter by letter. Maybe in some other languages, but I very rarely find myself doing
On 24/02/20 9:32 am, jdveiga@gmail.com wrote: that in Python. There is almost always some higher level way of doing what I want.
Not talking about how frequent walking on strings is done. I just saying that most languages provide a "pattern" (say, a way) of looping on strings (via indexing, via iterators, etc.) So, most languages, in some manner, "use" strings as they are sequences of characters. Like Python does. Since Python has a sequence type, strings were modelled as character sequence-objects and so they behave. In your opinion, if strings should not be sequences in Python, what they should be?
if strings are not longer sequences, how would Python do slicing on strings It's quite possible for a type to support slicing but not indexing.
Yeah, of course... do you think that we need to change the current syntax and the underlying string model to accommodate slicing but not indexing? What are we going to gain and what are we going to lose?