Ron Adam wrote:

>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
>
>  
>

Right.  The only thing in question is wording for the documentation. 

The viable options on the table are:
* Leave the current wording and add a clarifying example.
* Switch to left/sep/right and add a clarifying example.

The former tells you which part can still contain a separator and 
suggests how to use the tool when successive partitions are needed.  The 
latter makes the left/right ordering clear and tells you nothing about 
which part can still have the separators in it.  That has some import 
because the use cases for rpartition() all involve strings with multiple 
separators --if there were only one, you would just use partition().

BTW, the last check-in fixed the return value for the sep-not-found 
case, so that now:
   'a'.partition('x') -->  ('a', '', '')
   'a'.rpartition('x') -->  ('', '', 'a')

This was necessary so that looping/recursion would work and so that 
rpartition() acts as a mirror-image of partition().


Raymond





_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to