-inf<br><br>That breaks existing code in two different ways which I don't think makes it easy.<br><br>it does NOT collapse adjacent characters:<br>        >>> "a&&b".split("&")<br>

        ['a', '', 'b']<br><br>the separator it splits on is a string, not a character:<br>        >>> "a<b><c>d".split("><")<br>       
['a<b', 'c>d']<br><font color="#888888">
<br>--- Bruce</font><br><br><div class="gmail_quote">On Thu, Dec 11, 2008 at 4:38 PM, Ron Adam <span dir="ltr"><<a href="mailto:rrr@ronadam.com">rrr@ronadam.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d"><br>
<br>
Bruce Leban wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I think string.split(list) probably won't do what people expect either. Here's what I would expect it to do:<br>
<br>
 >>> '1 (123) 456-7890'.split([' ', '(', ')', '-'])<br>
['1', '', '123', '', '456', '7890']<br>
<br>
but what you probably want is:<br>
<br>
 >>>re.split(r'[ ()-]*', '1 (123) 456-7890')<br>
['1', '123', '456', '7890']<br>
<br>
using allows you to do that and avoids ambiguity about what it does.<br>
<br>
--- Bruce<br>
</blockquote>
<br></div>
Without getting into regular expressions, it's easier to just allow adjacent char matches to act as one match so the following is true.<br>
<br>
    longstring.splitchars(string.whitespace)  =  longstring.split()<div><div></div><div class="Wj3C7c"><br>
<br>
<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-ideas" target="_blank">http://mail.python.org/mailman/listinfo/python-ideas</a><br>
</div></div></blockquote></div><br>