[Python-Dev] Iterable String Redux (aka String ABC)
Georg Brandl
g.brandl at gmx.net
Tue May 27 23:31:06 CEST 2008
Antoine Pitrou schrieb:
> Georg Brandl <g.brandl <at> gmx.net> writes:
>> I'd argue that "find" is more primitive than "split" -- split is intuitively
>> implemented using find and slicing, but implementing find using split and
>> len is unintuitive. (Of course, "index" can be used instead of "find".)
>
> I meant semantically primitive. I think the difference between a String and a
> plain Sequence is that, in a String, the existence and relative position of
> substrings has a meaning. This is true for character strings but it can also be
> true for other kinds of strings (think genome strings, they are usually
> represented using ASCII letters but it's out of convenience - they could be made
> of opaque objects instead).
>
> That's why, in string classes, you have methods like split() to deal with the
> processing of substrings - which you do not have on lists, not that's it more
> difficult to implement or algorithmically less efficient, but because it makes
> no point.
>
> Well I hope it makes at least a bit of sense :-)
It does, but I don't see how it contradicts my proposition. find() takes a
substring as well.
Georg
More information about the Python-Dev
mailing list