Georg Brandl <g.brandl <at> gmx.net> writes: > You wrote: > > > If we stay minimalistic we could consider that the three basic operations that > > define a string are: > > - testing for substring containment > > - splitting on a substring into a list of substrings > > - slicing in order to extract a substring > > I argued that instead of split, find belongs into that list. > (BTW, length inquiry would be a fourth.)
Well, find() does test for substring containment, so in essence it is in that list, although in my first post I chose '__contains__' as the canonical representative of substring containment :-) And, you are right, length inquiry belongs into it too. > That the other methods, among them split, can be implemented in terms > of those, follows from both sets of basic operations. When I wrote "the three basic operations that define a string", perhaps I should have written "the three essential operations" instead. I was not attempting to give implementation guidelines but to propose a semantic definition of what constitutes a string and distinguishes it from other kinds of objects. Anyway, I think we are picking on words here. Do we agree on the following basic String interface : ['__len__', '__contains__', '__getitem__', 'find', 'index', 'split', 'rsplit']? cheers Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com