[Python-3000] characters data type

Guido van Rossum guido at python.org
Tue May 2 16:36:18 CEST 2006


On 5/1/06, Talin <talin at acm.org> wrote:
> Given that strings are going to be unicode, will there be a "characters"
> data type to go along with the "bytes" data type?

No. I'm not sure what you mean by "characters" but the only characters
that Python will support are Unicode characters. Python's 'str' and
'bytes' will be like String and byte[] in Java. But there won't be a
separate "char" type to represent the elements of 'str' -- like
before, a 1-char string will server nicely to represent a "character".
And a byte is represented by a Python int -- there won't be a separate
int-ish type constrained to range(0, 256).

> And how is the bytes
> data type different from the existing array type?

That remains to be seen. I expect it'll be rather similar but it's
focused on bytes only; the array type supports a number of other C
data types. The array type may even disappear -- I don't consider it a
big success. Maybe some part of a NumPy cor ewill finally be ready for
inclusion.

Josiah claims that bytes is similar to a list and array('B'). Since
the array type already supports many list methods (more than bytes
ATM!) I'm not sure what he's after. It's more likely that bytes will
evolve to be more like str, growing methods like startswith().

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list