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

Ron Adam rrr at ronadam.com
Tue Sep 5 20:44:40 CEST 2006


Ron Adam wrote:

Correcting myself...

> I hope this discussion is only about the words used and the 
> documentation and not about the actual order of what is received. I 
> would expect both the following should be true, and it is the current 
> behavior.
> 
>     ''.join(s.partition(sep)) -> s
>     ''.join(s.rpartition(sep)) -> s

>>> 'abcd'.partition('x')
('abcd', '', '')
>>> 'abcd'.rpartition('x')
('abcd', '', '')
>>>

Ok, I see Raymonds point, they are not what I expected.

Although the above is still true, the returned value for the not found condition
is inconsistent.

_Ron






More information about the Python-Dev mailing list