On 2002-06-13, Bjorn Pettersen wrote:
Ok, how about:
... def __contains__(self, s):
... return self.find(s) >= 0
...
1
Ok, how about:
class mystr(str):
... return self.find(s) >= 0
...
'hello' in mystr('hello world')
'foo' in mystr('hello world')
definition. Maybe call the class `substrings':
'hello' in substrings('hello world')
Or maybe `xsubstrings' to calm down the reader who would suspect that you
actually generated all substrings...
--
Beni Cherniavsky <cben at tx.technion.ac.il>