On Mon, Jun 29, 2020 at 21:30 MRAB <[email protected]> wrote:
> 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.
>
+1
--
--Guido (mobile)
_______________________________________________
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/RSIRZPE2YTUS7XN3ZYBYQZEHK2RYYUXP/
Code of Conduct: http://python.org/psf/codeofconduct/