[Python-Dev] Fwd: Problem withthe API for str.rpartition() (original) (raw)

Phillip J. Eby pje at telecommunity.com
Wed Sep 6 03:14:18 CEST 2006


At 02:08 AM 9/6/2006 +0100, David Hopwood wrote:

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.

It appears the problem is that one group of people thinks in terms of the order of the string, and the other in terms of the order of processing.

Both groups agree that both partition and rpartition should be "in the same order" -- but we disagree about what that means. :)

Me, I want left/sep/right because I'm in the "string order" camp, and you want upto/sep/rest because you're in the "processing order" camp.



More information about the Python-Dev mailing list