Raw string substitution problem

Aahz aahz at pythoncraft.com
Sat Jan 2 01:56:46 EST 2010


In article <7p2juvFu8tU1 at mid.individual.net>,
Gregory Ewing  <greg.ewing at canterbury.ac.nz> 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.

Assuming I remember correctly, the function capability came after the
replacement capability.  I think that breaking replacement would be a
Bad Idea.
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

Weinberg's Second Law: If builders built buildings the way programmers wrote 
programs, then the first woodpecker that came along would destroy civilization.



More information about the Python-list mailing list