Rawest raw string literals

Random832 random832 at fastmail.com
Thu Apr 20 16:43:00 EDT 2017


On Thu, Apr 20, 2017, at 16:01, Grant Edwards wrote:
> On 2017-04-20, MRAB <python at mrabarnett.plus.com> wrote:
> > There _is_ a "universal solution"; it's called a Hollerith constant. :-)
> 
> Wow, I haven't seen one of those in a _long_ time -- probably about 45
> years.  I think the first FORTAN implementation I used was WATFIV,
> which had just introduced the character type. But, books/classes on
> FORTRAN all still covered Hollerith constants.

The IMAP protocol uses a similar kind of construct (the length is
enclosed in braces)

Even ignoring the maintenance difficulty, I don't think it's possible to
syntax highlight something like that on most common editors.

The best solution I can think of is to have a text editor designed to
parse a string literal, spawn a nested editor with the unescaped
contents of that string literal, and then re-escape it back to place in
the code. If we had that, then we wouldn't even need raw strings.


More information about the Python-list mailing list