[Python-ideas] startsin ?

Matt Chaput matt at whoosh.ca
Fri Sep 30 18:09:16 CEST 2011


On 30/09/2011 11:30 AM, Tarek Ziadé wrote:
> not sure how people do this, or if I missed something obvious in the
> stdlib, but I often have this pattern:

str's interface is a bit cluttered with some questionable methods 
("captialize"? "center"? "swapcase"? "title"?) that probably should have 
been functions in a text module instead of methods. On the other hand, I 
do think this is a fairly common operation.

One thing is that the equivalent of .startsin() for .endswith() would be 
.endsin(). In English, "ends in" is a variation of "ends with", e.g. 
"What words end in 'a'?"

I think it would be better for startswith/endswith to accept a 
tuple/list argument.

Matt




More information about the Python-ideas mailing list