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



_______________________________________________
lilypond-devel mailing list
lilypond-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-devel

Reply via email to