Nested string substitutions

Lulu of the Lotus-Eaters mertz at gnosis.cx
Fri Dec 20 18:18:01 EST 2002


Antonio Cuni <TOGLIMIcuni at programmazione.it> wrote previously:
|First, we should use a better data structure for our job:
|subs = { 'foo': ['bar', 'baz'],
|         'bar': ['kat', 'www'],
|         'baz': [],
|         'kat': [],
|         'www': [] }

Unfortunately, this is the same wrong impression I conveyed to Holger
Krekel.  I need to do a string substitution, not an item substitution.
The things that get replaced need not be space-separated.

It's not clear to me how you would translate from this solution into one
that didn't rely on easy division of the candidate substitution tokens.
Fortunately, I like Meyer's function well enough.

Yours, Lulu...

--
mertz@  | The specter of free information is haunting the `Net!  All the
gnosis  | powers of IP- and crypto-tyranny have entered into an unholy
.cx     | alliance...ideas have nothing to lose but their chains.  Unite
        | against "intellectual property" and anti-privacy regimes!
-------------------------------------------------------------------------





More information about the Python-list mailing list