[Doc-SIG] backslashing

Edward D. Loper edloper@gradient.cis.upenn.edu
Mon, 16 Apr 2001 12:09:42 EDT


>> If you used E<lt> and E<gt> or E{lb} and E{rb} or something like that,
>> then regexps would generally look how they're supposed to (at least
>> when you print them).
> 
> So would *any other* convention -- when you print them. The point
> is, what do they look like when you read them?

Not when you print them with "print foo.__doc__"; only when you use
some tool to interpret them and print them..

> Another point: mark up "x > y" as an inline literal. If you use C<>,
> you need to escape. If you use C{}, you need to escape for some
> other case.

True.  But the advantage of C{} is that we can say that X{} is
markup for X=[A-Z], but any other *nested* {}s will be printed as {}s
(so, e.g., you can say C{ {1:'a', 2:'b'} })...  Which means that
you *almost* never need to use explicit escaping.  (you need it
if you want to talk about "{"s and "}"s themselves, as opposed to
objects defined with them.. or if you want to put a capital letter
before a "{").  In particular, I searched for all "{"s in the
standard library and the other packages I have installed on my
system, and found no examples where they would need to be escaped..

Once you introduce "\" as an escape character, though, all sorts of
"\"s now need to be escaped..  And I don't really like the convention
of keeping "\"s if they appear before something that doesn't require
escaping.. It taxes my brain too much.

I guess I'm trying to go on the principle of keeping the need to
escape characters to a minimum, because whatever escaping mechanism we
have, it'll be somewhat ugly/difficult to read.

-Edward