Rawest raw string literals

Mikhail V mikhailwas at gmail.com
Thu Apr 20 17:03:37 EDT 2017


On 20 April 2017 at 22:43, Random832 <random832 at fastmail.com> wrote:
> 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.

Yes exactly, it would be cool to have such a satellite app
which can escape and unescape strings according to rules.
And which can also convert unicode literals to their ascii
analogues and back on the fly, this would very useful
for programming.
Probably it is a good idea to even include such thing
in Python package. So it would be a small standalone app
running parallel with text editor making it to copy paste strings.


Mikhail



More information about the Python-list mailing list