Re: [Numpy-discussion] Array and string interoperability

2017-06-06 Thread Mikhail V
On 7 June 2017 at 00:05, Chris Barker wrote: > On Mon, Jun 5, 2017 at 3:59 PM, Mikhail V wrote: >> s= "012 abc" >> B = bytes(s.encode()) # convert to bytes >> k = len(s) >> arr = np.zeros(k,"u1") # init empty array length k >> arr[0:2] = list(B[0:2]) >> print ("my array: ", arr) >> -> >> my

Re: [Numpy-discussion] Array and string interoperability

2017-06-06 Thread Chris Barker
On Mon, Jun 5, 2017 at 4:06 PM, Mikhail V wrote: > Likely it was about some new string array type... yes, it was. > Obviously there is demand. Terror of unicode touches many aspects > of programmers life. I don't know that I'd call it Terror, but frankly, the fact that you need up to 4 byte

Re: [Numpy-discussion] Array and string interoperability

2017-06-06 Thread Chris Barker
On Mon, Jun 5, 2017 at 3:59 PM, Mikhail V wrote: > -- classify by "forward/backward" conversion: > For this time consider only forward, i.e. I copy data from string > to numpy array > > -- classify by " bytes vs ordinals ": > > a) bytes: If I need raw bytes - in this case e.g. > > B = b