new string method in 2.5 (partition)

Larry Bates larry.bates at websafe.com
Tue Sep 19 15:50:29 EDT 2006


John Salerno wrote:
> Bruno Desthuilliers wrote:
> 
>> Err... is it me being dumb, or is it a perfect use case for str.split ?
> 
> Hmm, I suppose you could get nearly the same functionality as using
> split(':', 1), but with partition you also get the separator returned as
> well.
> 
>> There are IMVHO  much exciting new features in 2.5 (enhanced
>> generators, try/except/finally, ternary operator, with: statement etc...)
> 
> I definitely agree, but I figure everyone knows about those already.
> There are also the startswith() and endswith() string methods that are
> new and seem neat as well.

FYI- .startswith() and .endswith() string methods aren't new in 2.5.
They have been around since at least 2.3.

Larry Bates



More information about the Python-list mailing list