[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: backslashes in escape rules
From: |
John Mandereau |
Subject: |
Re: backslashes in escape rules |
Date: |
Sat, 05 Jul 2008 09:51:36 +0200 |
On 2008/07/04 17:38 -0700, Graham Percival wrote:
> Quick check for convert rules, changing "\foo" to "\bar".
>
> The early rules use escape chars:
> @rule ((1, 0, 1), '\\accidentals -> \\keysignature,
> specialaccidentals -> keyoctaviation')
> def conv (str):
> str = re.sub ('\\\\accidentals', '\\\\keysignature',str)
>
> But the later rules don't use any backslashes:
> @rule ((2, 11, 48), "\\compressMusic -> \\scaleDurations")
> def conv (str):
> str = re.sub (r"compressMusic", r"scaleDurations", str)
> return str
>
>
> Which should I use? "foo", "\\foo", or "\\\\foo" ?
I guess the motivation for using "foo" iso. "\\\\foo" for regexp
substitution is making docs updating easier, as running text or comments
sometimes mention the command name without the backslash.
However, it's good to use "\\foo" (or r"\foo") in the rule description
that is printed when you do 'convert-ly -s'.
Cheers,
John
- backslashes in escape rules, Graham Percival, 2008/07/04
- Re: backslashes in escape rules,
John Mandereau <=
- Re: backslashes in escape rules, Graham Percival, 2008/07/05
- Re: backslashes in escape rules, John Mandereau, 2008/07/05
- Re: backslashes in escape rules, Carl D. Sorensen, 2008/07/05
- Re: backslashes in escape rules, John Mandereau, 2008/07/05
- Re: backslashes in escape rules, Carl D. Sorensen, 2008/07/06
- Re: backslashes in escape rules, John Mandereau, 2008/07/07
- Re: backslashes in escape rules, Graham Percival, 2008/07/05