LWN.net Logo

Changes ahead for Python

Changes ahead for Python

Posted Sep 20, 2007 17:19 UTC (Thu) by larryr (guest, #4030)
In reply to: Changes ahead for Python by walters
Parent article: Changes ahead for Python

The Py3k solution is to separate strings [...] and byte-strings [...] str and bytes
This is wrong as far as I can see; quoting from the page:
There is only one string type; its name is str but its behavior and implementation are more like unicode in 2.x. PEP 358: There is a new type, bytes, to represent binary data
Which makes sense, because what the heck would a byte-string be? There are strings which contain Unicode, and byte *arrays* (calling them strings just leads to confusion).

To me, the array in this case comprises a series of 8-bit characters, which to me is a string, and to me a "byte string" is a reasonable and useful thing to call it; it is a string whose (character) elements each have a size of one byte.

Larry


(Log in to post comments)

Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.