[Numpy-discussion] A one-byte string dtype?

Oscar Benjamin oscar.j.benjamin at gmail.com
Mon Jan 20 13:40:32 EST 2014


On Jan 20, 2014 5:21 PM, "Charles R Harris" <charlesr.harris at gmail.com>
wrote:
> On Mon, Jan 20, 2014 at 10:12 AM, Aldcroft, Thomas <
aldcroft at head.cfa.harvard.edu> wrote:
>> On Mon, Jan 20, 2014 at 10:40 AM, Oscar Benjamin <
oscar.j.benjamin at gmail.com> wrote:
>>> On Mon, Jan 20, 2014 at 10:00:55AM -0500, Aldcroft, Thomas wrote:
>>> > On Mon, Jan 20, 2014 at 5:11 AM, Oscar Benjamin
>>>
>>> And why are you needing to write .decode('ascii') everywhere?
>>
>> >>> print("The first value is {}".format(bytestring_array[0]))
>>
>> On Python 2 this gives "The first value is string_value", while on
Python 3 this gives "The first value is b'string_value'".
>
> As Nathaniel has mentioned, this is a known problem with Python 3 and the
developers are trying to come up with a solution. Python 3.4 solves some
existing problems, but this one remains. It's not just numpy here, it's
that python itself needs to provide some help.

If you think that anything in core Python will change so that you can mix
text and bytes as above then I think you are very much mistaken. If you're
referring to PEP 460/461 then you have misunderstood the purpose of those
PEPs. The authors and reviewers will carefully ensure that nothing changes
to make the above work the way that it did in 2.x.

Oscar
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140120/2b0e1d21/attachment.html>


More information about the NumPy-Discussion mailing list