[Python-Dev] Re: adding a bytes sequence type to Python
mal at egenix.com
Wed Aug 18 20:31:17 CEST 2004
Martin v. Löwis wrote:
> M.-A. Lemburg wrote:
>> I'm still not convinced that we can simply drop the existing
>> immutable 8-bit string type and replace it with a mutable
>> bytes or buffer type, e.g. would buffer.lower() work on the
>> buffer itself or return a lowered copy ?
> The byte string type would not have a .lower method, as
> "lowering" is not meaningful for bytes, only for characters.
Indeed... and the same is true for almost all other methods
(except maybe .replace()).
Sounds like a lot of code will break.
OTOH, it will also enforce the notion of doing encoding and decoding
only at IO boundaries and being explicit about character sets which
is good in the long run.
Auto-conversion using the default encoding will get us
all ASCII character (Unicode) strings converted to buffers
without problems (and without having the need for an extra
This leaves the question of how to deal with the byte range
0x80 - 0xFF. The straight forward solution would be to switch
to Latin-1 as default encoding and let the same magic take
care of that byte range as well.
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