Raw string substitution problem
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Fri Dec 18 22:29:32 EST 2009
More information about the Python-list mailing list
Fri Dec 18 22:29:32 EST 2009
- Previous message (by thread): Raw string substitution problem
- Next message (by thread): basic grammer error..
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, 19 Dec 2009 02:24:00 +0000, MRAB wrote: > Gregory Ewing wrote: >> MRAB wrote: >> >>> In simple cases you might be replacing with the same string every >>> time, but other cases you might want the replacement to contain >>> substrings captured by the regex. >> >> But you can give it a function that has access to the match object and >> can produce whatever replacement string it wants. >> >> You already have a complete programming language at your disposal. >> There's no need to invent yet another mini-language for the replacement >> string. >> > There's no need for list comprehensions either, but they're much-used > shorthand. The same can't be said for regex replacement strings, which are far more specialised. And list comps don't make anything *harder*, they just make things easier. In contrast, the current behaviour of regex replacements makes it difficult to use special characters as part of the replacement string. That's not good. -- Steven
- Previous message (by thread): Raw string substitution problem
- Next message (by thread): basic grammer error..
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list