str.(r)partition: factor our duplicate code.

Both str.partition and str.rpartition now search left to right.