[Python-Dev] Re: adding a bytes sequence type to Python (original) (raw)

M.-A. Lemburg mal at egenix.com
Wed Aug 18 10:49:52 CEST 2004


Roman Suzi wrote:

On Tue, 17 Aug 2004, M.-A. Lemburg wrote:

Roman Suzi wrote:

On Tue, 17 Aug 2004, M.-A. Lemburg wrote: It was in the shadows because we had byte-strings. Right, so why not revive it ?! Anyway, this whole discussion about a new bytes type doesn't really solve the problem that the b'...' literal was intended for: that of having a nice way to define (read-only) 8-bit binary string literals. I think new mutable bytes() type is better than old 8-bit binary strings for binary data processing purposes. Or do we need them for legacy text-procesing software?

Hmm, who ever said that we are going to drop the current 8-bit string implementation ?

I'm only suggesting to look at what's there instead of trying to redo everything in slightly different way, e.g. you can already get the bytes() functionality from buffer type at C level - it's just that this functionality is not exposed at Python level.

We already have a number of read-write types for storing binary data, e.g. arrays, cStringIO and buffers. Inventing yet another way to spell binary data won't make life easier.

However, what will be missing is a nice way to spell read-only binary data. Since 'tada' will return a Unicode object in Py3k, I think we should reuse the existing 8-bit string object under the new literal constructor b'tada\x00' (and apply the same source code encoding semantics we apply today for 'tada\x00').

-- Marc-Andre Lemburg eGenix.com

Professional Python Services directly from the Source (#1, Aug 18 2004)

Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/


::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,FreeBSD for free ! ::::



More information about the Python-Dev mailing list