On 2020-06-30 02:14, Steven D'Aprano wrote:
[snip]
Counter-proposal: hex escapes allow optional curly brackets, similar to
unicode name escapes. You could even allow spaces within the braces, for
grouping:
# Existing:
"\N{HYPHEN-MINUS}" # '-'
"\x2b" # '+'
# Proposed enhancement:
"\x{2b}2c" # '+2c'
"\x{2b2c}" # '+,'
"\x{DEAD BEEF}" # "\xDE\xAD\xBE\xEF"
This could work in f-strings and bytes as well. I think this might be of
use for people who do a lot of work with binary file formats and hex
escapes.
I think this is backwards compatible too, since "\x{" is currently a
syntax error.
There's a precedent in other languages that use this form instead of
\uXXXX and \UXXXXXXXX.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/PTYAP4JBRE73GJDOPO2DIEPEP3VQFQFW/
Code of Conduct: http://python.org/psf/codeofconduct/