[Python-Dev] Iterable String Redux (aka String ABC) (original) (raw)

Armin Ronacher armin.ronacher at active-4.com
Tue May 27 23:19:49 CEST 2008


Hi,

Georg Brandl <g.brandl 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".) It surely is, but it would probably make sense to require both. Maybe have something like this:

class SymbolSequence(Sequence) class String(SymbolSequence)

String would be the base of str/unicode and CharacterSequence of str/bytes. A SymbolSequence is basically a sequence based on one type of symbols that implements slicing, getting symbols by index, count() and index(). A String is basically everything a str/unicode provides as method except of those which depend on informatio based on the symbol. For example upper() / isupper() etc would go. Additionally I guess it makes sense to get rid of encode() / decode() / format().

Regards, Armin



More information about the Python-Dev mailing list