On 2006-10-17, Tim Chase <[EMAIL PROTECTED]> wrote: > If you're doing it on a time-critical basis, it might help to > make "valid" a set, which should have O(1) membership testing, > rather than using the "in" test with a string. I don't know > how well the find() method of a string performs in relationship > to "in" testing of a set. Test and see, if it's important.
The find method of (8-bit) strings is really, really fast. My guess is that set can't beat it. I tried to beat it recently with a binary search function. Even after applying psyco find was still faster (though I could beat the bisect functions by a little bit by replacing a divide with a shift). -- Neil Cerutti This is not a book to be put down lightly. It should be thrown with great force. --Dorothy Parker -- http://mail.python.org/mailman/listinfo/python-list