
18 Sep
2007
18 Sep
'07
2:22 p.m.
On 9/18/07, Johannes Waldmann
but what for? In a real application, I guess you want to do some further processing, so the index is just some intermediate result (you will acccess the string via the index later).
Actually, sometimes I needed the string from the beginning of the search to the match point (in which case the tuple would do what I wanted). In other cases, I needed to know the length of the matched string. In that case, knowing the index of the match made it very fast to calculate the length without looking at the string. While the length of a strict bytestring is very cheap (O(1)), the length of a lazy bytestring is not. Being able to do the above optimization was important to my application. Justin