String2List: odd function
Isidor
rodisi01 at my-deja.com
Wed Jul 21 10:00:46 EDT 1999
Dear Pythonographers -
Here is a very odd little something I have written in the process
of trying to make ModuleWriter module (see previous message) deal
with "documentary" strings.
Takes a list-like string, e.g.,:
"[['itema1', 'itema2'], 'itemb1', ['cheese1', ['cheese1a',
'cheese1b'], '2'], ''blah' rest of itemb2', 'zib']"
and returns *real* lists:
[['itema1', 'itema2'], 'itemb1', ['cheese1', ['cheese1a',
'cheese1b'], '2'], "'blah' rest of itemb2", 'zib']
Which, in text-world, looks like nothing more than the removal of
some quotation marks, but in Python-world...well, I don't have to
tell you what the difference is.
This function is probably a poster child for code-in-need-of-
optimization. I have probably written the slowest possible
version (actually, that's a boast to which I don't have the right
to make either!)...I have written the most obvious clunker-headed
version. I will be interested to hear suggestions for making it
speedier and svelter. (I suspect that Guido's optimizations
essay(s) may be useful here. I will have to review them.)
GETTING IT: (repeated from my ModuleWriter message)
I don't have web space where I can put this right now, so e-mail
me at rodisi01 at my-deja.com, and every day or every other day, I
will send a copy off to whoever has requested it. I know this is
a hassle, I'm sorry. If it looks like there is serious interest
in this thing, I will find some web space for it so you can click
and save to your heart's content. In fact, I thought I heard
someone in this list talk about offering web space for python
projects....;)...
ALTERNATIVELY:
If someone will point me to (or give me) some suggestions re.
posting code to the newsgroup, I could just do that. I'm worried
about line breaks and all that stuff. Would an ascii attachment
work in deja-world? (I've never had much access to newsgroups, so
this is all sort of new to me, and I have to use the free and
powerful (many many thanks!) but somewhat frustrating deja-news
interface.)
I hope someone finds this interesting or at least amusing!
Isidor
More information about the Python-list
mailing list