[Python-Dev] Re: adding a bytes sequence type to Python

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


Martin v. Löwis wrote:
> Skip Montanaro wrote:
> 
>> My understanding is that bytes
>> objects are just that, raw sequences of bytes in the range 0x00 to 0xff,
>> inclusive, with no interpretation of any type.
> 
> 
> Yes, but your understanding is limited :-) This idea is good, but it
> falls short once we talk about source code, because source code does
> have an encoding. So if you don't want to incorporate the notion of
> encodings into the byte string types, yet be able to declare them
> in source code, you have to go for a numeric representation. I.e.
> you write
>    bytes(71,69, 84)
> instead of
>    b"GET"
> 
> As soon as you use some kind of string notation for denoting byte
> code values, you immediately *have* to deal with encodings.

Of course you do, but aren't you making things too complicated,
Martin ?

If you write your string literal using just ASCII characters and
escapes, I don't see much of a problem with different source code
encodings. If it makes you feel better, we could even enforce
this by only allowing these characters in binary string literals.

-- 
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