John Machin wrote: > Steven Bethard wrote: > >> John Machin wrote: >> >>> For example, text = 'foo bar', chunks = ['foobar'] >> >> This doesn't match the (admittedly vague) spec > > That is *exactly* my point -- it is not valid input, and you are not > reporting all cases of invalid input; you have an exception where the > non-spaces are impossible, but no exception where whitespaces are > impossible.
Well, the input should never look like the above. But if for some reason it did, I wouldn't want the error; I'd want the indices. So: text = 'foo bar' chunks = ['foobar'] should produce: [(0, 7)] not an exception. STeVe -- http://mail.python.org/mailman/listinfo/python-list