Language design
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Tue Sep 10 20:53:53 EDT 2013
On Wed, 11 Sep 2013 01:03:48 +0100, Nobody wrote:
> On Tue, 10 Sep 2013 17:07:09 +1000, Ben Finney wrote:
>
>> * Python requires every programmer to know, or quickly learn, the
>> basics
>> of Unicode: to know that text is not, and never will be again,
>> synonymous with a sequence of bytes.
>
> If only the Python developers would learn the same lesson ...
>
> Some of them are so hooked on Unicode that they won't accept that
> sometimes a sequence of bytes really is just a sequence of bytes.
> Primary example: most of the POSIX API.
And lo, Guido's Time Machine strikes again. Python 3 has not one but TWO
built-in types for handling sequences of bytes:
* bytes # immutable string of bytes
* bytearray # mutable array of bytes
and most routines that handle file names accept either text strings or
bytes strings:
py> open('aß', 'w').write("hello\n")
6
py> open(b'a\xc3\x9f', 'r').read()
'hello\n'
--
Steven
More information about the Python-list
mailing list