(Aug-06-2021, 11:01 PM)Yoriz Wrote: Call it with next
as I did in the example above.
next also isn't a callable or a function I can pass around. I'd need to wrap it in something to hand it to re.sub().
If I hand
sub
a replacement string, then I have to call sub
n times for n replacements. But if I hand sub
a function, then it goes off and does all the work (in C code) and just calls the function for the replacement when necessary. That second thing is what I was doing for performance. But the argument there must be a true callable that will be handed a match object and must return a string that will become the replacement.