[Python-Dev] partition() (was: Remove str.find in 3.0?)

Ron Adam rrr at ronadam.com
Wed Aug 31 15:41:38 CEST 2005


Nick Coghlan wrote:
> Ron Adam wrote:
> 
>>I don't feel there is a need to avoid numbers entirely. In this case I
>>think it's the better way to find the n'th seperator and since it's an
>>optional value I feel it doesn't add a lot of complication.  Anyway...
>>It's just a suggestion.
> 
> 
> Avoid overengineering this without genuine use cases. Raymond's review of the 
> standard library shows that the basic version of str.partition provides 
> definite readability benefits and also makes it easier to write correct code - 
> enhancements can wait until we have some real experience with how people use 
> the method.
> 
> Cheers,
> Nick.

The use cases for nth items 1 and -1 are the same ones for partition() 
and rpartition.  It's only values greater or less than those that need 
use cases.  (I'll try to find some.)

True, a directional index enhancement could be added later, but not 
considering it now and then adding it later would mean rpartition() 
would become redundant and/or an argument against doing it later.

As it's been stated fairly often, it's hard to remove something once 
it's put in. So it's prudent to consider a few alternative forms and 
rule them out, rather than try to change things later.

Cheers,
Ron



More information about the Python-Dev mailing list