PEP263 (Specifying encoding) and bytecode strings

Bengt Richter bokr at oz.net
Tue May 6 13:40:34 EDT 2003


On Tue, 6 May 2003 16:45:44 GMT, Michael Hudson <mwh at python.net> wrote:

>bokr at oz.net (Bengt Richter) writes:
>
>> On 06 May 2003 07:36:46 +0200, martin at v.loewis.de (Martin v. =?iso-8859-15?q?L=F6wis?=) wrote:
>> 
>> >bokr at oz.net (Bengt Richter) writes:
>> >
>> >> Has there been any suggestions for a multicharacter hex escape, e.g.,
>> >> 'Something like \<ABCDEF> this?'
>> >
>> >What would be the exact meaning of such an escape, and why would it be
>> >useful?
>> 
>> assert '\<ABCDEF>' == '\xAB\xCD\xEF'
>> 
>> For more compact representation of multiple escaped characters
>> in a string literal, perhaps machine generated to represent binary.
>> EOLs and white space could be transparent inside the brackets, to make
>> nice blocked formatting, e.g.,
>>     s = '\<
>>         ABCD
>>         EF01
>>     >
>
>Or you could insert a call to binascii.decode_string (or whatever it's
>called).  Although that wouldn't happen at compile time.
>
>I'm deeply unconvinced that inserting binary data into string literals
>is a common enough need to add language support.  Disk space is cheap,
"Build it and they will come" ;-) It's not a matter of whether it _is_
common enough, it's a matter of whether it would be.

>people!  And these files should compress well, too.
Which files should compress well? Some do, some don't, ISTM.

>
>(oh, and^2: if you used \<, I have code that would break).
>
Ok, throw an extra char to the wind: '\x<ABCDEF>' ;-)

Regards,
Bengt Richter




More information about the Python-list mailing list