A proposal idea for string.split with negative maxsplit
Antoon Pardon
apardon at forel.vub.ac.be
Fri Jan 28 04:19:46 EST 2005
I was wondering what people whould think about a change of behaviour
in the split method fo strings. The idea would be that if maxsplit
was negative then abs(maxsplit) splits would be done, but splitting
would start from the right instead of the left.
Now we have.
>>> "st1:st2:st3:st4:st5".split(':',2)
["st1" , "st2" , "st3:st4:st5"]
This behaviour would remain but additionally we would have the
following.
>>> "st1:st2:st3:st4:st5".split(':',-2)
["st1:st2:st3" , "st4" , "st5"]
What do people think here?
--
Antoon Pardon
More information about the Python-list
mailing list