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

John J Lee jjl at pobox.com
Tue Sep 5 20:22:11 CEST 2006


On Tue, 5 Sep 2006, Fred L. Drake, Jr. wrote:

> On Tuesday 05 September 2006 13:24, Michael Chermside wrote:
> > How about something like this:
> >
> >     S.partition(sep) -> (head, sep, tail)
> >     S.rpartition(sep) -> (tail, sep, rest)
>
> I think I prefer:
>
>    S.partition(sep) -> (head, sep, rest)
>    S.rpartition(sep) -> (tail, sep, rest)
>
> Here, "rest" is always used for "what remains"; head/tail are somewhat more
> clear here I think.

But isn't rest is in the wrong place there, for rpartition: that's not the 
string that you might typically call.rpartition() on a second time.  How 
about:

     S.partition(sep) -> (left, sep, rest)
     S.rpartition(sep) -> (rest, sep, right)


John


More information about the Python-Dev mailing list