[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Python 3.2 has some deadly infection

On Thu, 05 Jun 2014 16:37:23 +0100, Robin Becker wrote:

> In python 3 byte strings
> are second class which I think is wrong

It certainly is wrong. bytes are just as much a first-class built-in type 
as list, int, float, bool, set, tuple and str.

There may be missing functionality (relatively easy to add new 
functionality), and even poor design choices (like the foolish decision 
to have bytes display as if they were ASCII-ish strings, a silly mistake 
that simply reinforces the myth that bytes and ASCII are synonymous). 
Python 3.4 and 3.5 are in the process of rectifying as many of these 
mistakes as possible, e.g. adding back % formatting. But a few mistakes 
in the design of bytes' API no more makes it "second-class" than the lack 
of dict.contains_value() method makes dict "second-class".

By all means ask for better bytes functionality. But don't libel Python 
by pretending that bytes is anything less than one of the most important 
and fundamental types in the language. bytes are so important that there 
are TWO implementations for them, a mutable and immutable version 
(bytearray and bytes), while text strings only have an immutable version.

Steven D'Aprano