Roberto Bonvallet wrote: >> this is why e.g. >> >> string[:len(prefix)] == prefix >> >> is often a lot faster than >> >> string.startswith(prefix) > > This is interesting. In which cases does the former form perform better?
no time to doublecheck right now, but iirc, last time we benchmarked this, slicing was faster when len(prefix) < 300 characters or so. </F> -- http://mail.python.org/mailman/listinfo/python-list