PEP263 (Specifying encoding) and bytecode strings
Michael Hudson
mwh at python.net
Tue May 6 12:45:44 EDT 2003
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,
people! And these files should compress well, too.
(oh, and^2: if you used \<, I have code that would break).
Cheers,
M.
--
Python enjoys making tradeoffs that drive *someone* crazy <wink>.
-- Tim Peters, comp.lang.python
More information about the Python-list
mailing list