new string method in 2.5 (partition)
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Wed Sep 20 18:21:50 EDT 2006
John Salerno a écrit :
> 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.
Well, you already know it since you use it to either split() or
partition the string !-)
Not to say these two new methods are necessary useless - sometimes a
small improvement to an API greatly simplifies a lot of common use cases.
>> 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
Err... 'new' ???
> and seem neat as well.
More information about the Python-list
mailing list