[Python-Dev] Fwd: Problem withthe API for str.rpartition()
david.nospam.hopwood at blueyonder.co.uk
Wed Sep 6 03:08:03 CEST 2006
Barry Warsaw wrote:
> The bias with these terms is clearly the English left-to-right
> order. Actually, that brings up an interesting question: what would
> happen if you called rpartition on a unicode string representing
> Hebrew, Arabic, or other RTL language? Do partition and rpartition
> suddenly switch directions?
What happens is that rpartition searches the string backwards in logical
order (i.e. left to right as the text is written, assuming it only contains
Hebrew or Arabic letters, and not numbers or a mixture of scripts). But this
is not "switching directions"; it's still searching backwards. You really
don't want to think of bidirectional text in terms of presentation, when
you're doing processing that should be independent of presentation.
> If not, then I think left-sep-right are fine. If so, then yeah, we
> probably need something else.
+1 for (upto, sep, rest) -- and I think it should be in that order for
both partition and rpartition.
David Hopwood <david.nospam.hopwood at blueyonder.co.uk>
More information about the Python-Dev