[Python-Dev] Re: adding a bytes sequence type to Python
Bob Ippolito
bob at redivi.com
Tue Aug 17 22:20:49 CEST 2004
On Aug 17, 2004, at 4:07 PM, Martin v. Löwis wrote:
> Bill Janssen wrote:
>> Yes. My guess is that if you leave it out, you'll see
>> var = u"foo".encode("ASCII")
>> all over the place (assuming that encode() will produce a bytes type).
>
> If you also had
>
> var = bytes(u"foo")
>
> then I guess people would prefer that. People who want to save typing
> can do
>
> b = bytes
>
> and, given that the u prefix will be redundant, write
>
> var = b("foo")
How would you embed raw bytes if the string was unicode? Maybe there
should be something roughly equivalent to this:
bytesvar = r"delimited packet\x00".decode("string_escape")
"string_escape" would probably be a bad name for it, of course.
-bob
More information about the Python-Dev
mailing list