Mutable strings

Gordon Airport uce at ftc.gov
Mon Sep 22 17:25:34 EDT 2003


Peter Hansen wrote:
> Gordon Airport wrote:
> 
>>Peter Hansen wrote:
>>
>>snip good points that I suspect could be handled with a fairly simple
>>regex
> 
> 
> I'd argue the point, but I guess until you try it, we'll never know. <wink>
> 

Okay, I've tried it and I'll chalk it up to my inexperience with regular 
expressions and sed, but I don't have anyhting to show. The general 
strategy , though, is to make several passes; first escape all inner 
strings, then convert all outer string delimiters (now the only ones not 
escaped) to the immutable symbol. I feel like I'll wake up at 2 a.m. 
with the answer, but I'll post now anyway.
(Assuming you /can/ say "every instance of A between B's" in regex...you 
could always do it with a python script)

<snip>
> 
> 
> Apparently it served its purpose quite well.  The main problem before
> the PEP and vote was that there was no PEP to point to when somebody
> asked about it, so you could say "asked and answered... will not happen".
> 
> Now there is, and the few times the issue has come up since, someone
> has fairly quickly pointed to the PEP each time, avoiding lengthier
> discussion.
> 
> -Peter

Fair enough. Maybe I will submit a PEP for this, I've never looked into 
what's involved.





More information about the Python-list mailing list