[Python-ideas] Allowing negative `maxsplit` in `str.split`

cool-RR cool-rr at cool-rr.com
Sun May 16 23:07:15 CEST 2010


Here's something that I would want now: An ability to give a negative
`maxsplit` argument to `str.split`, to make it start splitting from the end
of the string.

For example, right now I wanted to be able to separate a module's name
'hello.world.meow' to ['hello.world', 'meow'] without knowing how many dots
would be in the name. If I could give a `maxsplit` of -1 to achieve this, it
would be nice.

What do you think?

Ram.

(Please `cc` any replies to me if you can, thanks.)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20100516/2227f530/attachment.html>


More information about the Python-ideas mailing list