<p dir="ltr">On Aug 19, 2016 11:14 PM, "Alexander Heger" <<a href="mailto:python@2sn.net">python@2sn.net</a>> wrote:<br>
><br>
> standard python should discontinue to see strings as iterables of characters - length-1 strings. I see this as one of the biggest design flaws of python. It may have seem genius at the time, but it has passed it usefulness for practical language use.</p>
<p dir="ltr">I'm bothered by it whenever I want to write code that takes a sequence and returns a sequence of the same type.</p>
<p dir="ltr">But I don't think that the answer is to remove the concept of strings as sequences. And I don't want strings to be sequences of character code points, because that's forcing humans to think on the implementation level. </p>
<p dir="ltr">Please explain the problem with the status quo, preferably with examples where it goes wrong.<br></p>
<p dir="ltr">> For example, numpy has no issues<br>
><br>
> >>> np.array('abc')<br>
> array('abc', dtype='<U3')</p>
<p dir="ltr">That says, "This is a 0-length array of 3-char Unicode strings." Numpy doesn't recognize the string as a specification of an array. Try `np.array(4.)` and you'll get (IIRC) `array(4., dtype='float')`, which has shape `()`. Numpy probably won't let you index either one. What can you even do with it? (By the way, notice that the string size is part of the dtype.)</p>
<p dir="ltr">> whereas, as all know, <br>
><br>
> >>> list('abc')<br>
> ['a', 'b', 'c']<br>
><br>
> Numpy was of course design a lot later, with more experience in practical use (in mind).</p>
<p dir="ltr">Numpy is for numbers. It was designed with numbers in mind. Numpy's relevant experience here is waaaay less than general Python's.</p>