Pyhon 2.x or 3.x, which is faster?

Chris Angelico rosuav at gmail.com
Mon Mar 7 19:45:46 EST 2016


On Tue, Mar 8, 2016 at 11:22 AM, BartC <bc at freeuk.com> wrote:
>
> (Is a byte string the same as a byte array? Is a byte array the same as an
> array.array? If I remove this line from my code, where 'data' has just been
> read from a file:
>
>    data=array.array('B',data)
>
> then it still works - Python 3. But not on Python 2. If I do .read on a
> binary file I get a byte string in Python 3, but a string in Python 2. That
> sort of mess.

The default string in Py2 *is* a byte string.

ChrisA



More information about the Python-list mailing list