[Numpy-discussion] String type again.

Pauli Virtanen pav at iki.fi
Fri Jul 18 13:26:59 EDT 2014


18.07.2014 19:33, Chris Barker kirjoitti:
> On Fri, Jul 18, 2014 at 9:07 AM, Pauli Virtanen <pav at iki.fi>
> wrote:
> 
>> Another approach would be to add a new 1-byte unicode
> 
> you can't do unicode in 1-byte -- so what does this mean, exactly?

The first 256 unicode code points, which happen to coincide with latin1.

>> This also is not perfect, since array(['foo']) on Py2 should for 
>> backward compatibility continue returning dtype='S'.
> 
> yup. but we may be OK -- as "bytes" in py2 is the same as string
> anyway. But what do we do with null bytes? when going from 'S' to
> py2 string?

Changing the null chopping and preserving backward compat would
require yet another new dtype. This would then mean that the 'S' dtype
would become pretty much deprecated on Py3.

Forcing everyone to re-do their Python 3 ports would be somewhat
cleaner. However, this train may have left a couple of years ago.

-- 
Pauli Virtanen



More information about the NumPy-Discussion mailing list