On Aug 19, 2016 11:14 PM, "Alexander Heger" <pyt...@2sn.net> wrote:
>
> 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.

I'm bothered by it whenever I want to write code that takes a sequence and
returns a sequence of the same type.

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.

Please explain the problem with the status quo, preferably with examples
where it goes wrong.

> For example, numpy has no issues
>
> >>> np.array('abc')
> array('abc', dtype='<U3')

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.)

> whereas, as all know,
>
> >>> list('abc')
> ['a', 'b', 'c']
>
> Numpy was of course design a lot later, with more experience in practical
use (in mind).

Numpy is for numbers. It was designed with numbers in mind. Numpy's
relevant experience here is waaaay less than general Python's.
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to