<font size=2 face="sans-serif">Hi Docs,</font>
<br>
<br><font size=2 face="sans-serif">I just tripped myself up with the maxsplit
parameter to re.split while parsing SPF records ...</font>
<br>
<br><font size=2 face="sans-serif">>>> max = 2</font>
<br><font size=2 face="sans-serif">>>> re.split(':','ip6:fe80:dead:beef:cafe::36',maxsplit=max)</font>
<br><font size=2 face="sans-serif">['ip6', 'fe80', 'dead:beef:cafe::36']</font>
<br><font size=2 face="sans-serif">>>></font>
<br><font size=2 face="sans-serif">>>> max = 1</font>
<br><font size=2 face="sans-serif">>>> re.split(':','ip6:fe80:dead:beef:cafe::36',maxsplit=max)</font>
<br><font size=2 face="sans-serif">['ip6', 'fe80:dead:beef:cafe::36']</font>
<br>
<br><font size=2 face="sans-serif">Re-re-re-reading the docs I see now
that maxsplit is in fact the maximum number of _splits_ that occur not
the number of fields that result.</font>
<br>
<br><font size=2 face="sans-serif">FWIW I am relatively new to Python so
my terminology will be off but does a patch something like the appended
make sense?</font>
<br>
<br><font size=2 face="sans-serif">tnx,</font>
<br>
<br><font size=2 face="sans-serif">/b</font>
<br>
<br><a href=http://docs.python.org/n.m/_sources/library/re.txt><font size=2 face="sans-serif">http://docs.python.org/n.m/_sources/library/re.txt</font></a>
<br>
<br><font size=2 face="sans-serif">$ diff -uw re.orig re.txt</font>
<br><font size=2 face="sans-serif">--- re.orig     2013-10-22
16:01:50.876739700 -0400</font>
<br><font size=2 face="sans-serif">+++ re.txt      2013-10-22
16:02:39.752052500 -0400</font>
<br><font size=2 face="sans-serif">@@ -589,7 +589,7 @@</font>
<br><font size=2 face="sans-serif">    Split *string* by the
occurrences of *pattern*.  If capturing parentheses are</font>
<br><font size=2 face="sans-serif">    used in *pattern*, then
the text of all groups in the pattern are also returned</font>
<br><font size=2 face="sans-serif">    as part of the resulting
list. If *maxsplit* is nonzero, at most *maxsplit*</font>
<br><font size=2 face="sans-serif">-   splits occur, and the remainder
of the string is returned as the final element</font>
<br><font size=2 face="sans-serif">+   splits occur, creating a list
*maxsplit+1* elements in length with the remainder of the string is returned
as the final element</font>
<br><font size=2 face="sans-serif">    of the list. ::</font>
<br>
<br><font size=2 face="sans-serif">       >>>
re.split('\W+', 'Words, words, words.')</font>