[Python-Dev] Death to string functions!
Christopher Petrilli
petrilli@amber.org
Tue, 19 Dec 2000 10:25:18 -0500
So I was thinking about this whole thing, and wondering why it was
that seeing things like:
" ".join(aList)
bugged me to no end, while:
aString.lower()
didn't seem to look wrong. I finally put my finger on it, and I
haven't seen anyone mention it, so I guess I'll do so. To me, the
concept of "join" on a string is just not quite kosher, instead it
should be something like this:
aList.join(" ")
or if you want it without the indirection:
['item', 'item', 'item'].join(" ")
Now *THAT* looks right to me. The example of a join method on a
string just doesn't quite gel in my head, and I did some thinking and
digging, and well, when I pulled up my Smalltalk browser, things like
join are done on Collections, not on Strings. You're joining the
collection, not the string.
Perhaps in a rush to move some things that were "string related" in
the string module into methods on the strings themselves (something I
whole-heartedly support), we moved a few too many things
there---things that symantically don't really belong as methods on a
string object.
How this gets resolved, I don't know... but I know a lot of people
have looked at the string methods---and they each keep coming back to
1 or 2 that bug them... and I think it's those that really aren't
methods of a string, but instead something that operates with strings,
but expects other things.
Chris
--
| Christopher Petrilli
| petrilli@amber.org