[Python-3000] characters data type

Guido van Rossum guido at python.org
Tue May 2 18:44:06 CEST 2006


On 5/2/06, Josiah Carlson <jcarlson at uci.edu> wrote:
>
> "Guido van Rossum" <guido at python.org> wrote:
> > 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().
>
> I was just explaining what was currently in the bytes PEP.

Oops. I lost track of the bytes proto-PEP. CC'ing Neil now -- Neil,
did you submit that to the PEP editors? The bytes object that I
actually implemented is substantially similar to the draft, but
differs in details. (The details will have to change anyway because
the PEP curerntly distinguishes between str and unicode initializers,
which makes no sense for Py3k.) I didn't implement fromhex(), although
it may be a good idea. I didn't implement all the proposed methods yet
(none of the list methods are implemented) and I implemented more
string-ish behavior (e.g. __contains__ implements substring matching
as well as element searching).

> There are
> other things I would personally like to have in the bytes object (string
> methods are almost a requirement, some file-like methods would be
> convenient; to replace StringIO, but not necessary), but no one seems to
> have replied to my most recent post on the topic.

Perhaps because you generate posts faster than most people can read. I
don't have time to reply to every single item on your list; I'd just
recommend that you calm down. (But I want to add that unifying bytes
and StringOI seems a bad idea -- StringIO contains state beyond the
contents of the array and it makes more sense to use a separate object
for that.)

> I also happen to think that the lack of a bytes literal beyond
> bytes([1,2,3]), bytes("...", encoding="..."), or "...".encode("..."),
> will make some uses a bit cumbersome, as will its mutability (see the
> points I've been trying to make in regards to parsing / unmarshalling /
> operationX).

I think it's way too soon to know.

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


More information about the Python-3000 mailing list