homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tim.peters
Recipients
Date 2003年12月02日.15:20:27
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=31435
Confirmed on Pythons 2.1.3, 2.2.3, 2.3.2, and current CVS.
More generally, split() doesn't appear to split on any empty 
(0-length) match. For example,
>>> pat = re.compile(r'\b')
>>> pat.split('(a b)')
['(a b)']
>>> pat.findall('(a b)') # but the pattern matches 4 places
['', '', '', '']
>>>
That's probably a design constraint, but isn't documented. 
For example, if you split "abc" by the pattern x*, what do you 
expect? The pattern matches (with length 0) at 4 places, 
but I bet most people would be surprised to get
['', 'a', 'b', 'c', '']
back instead of (as they do get)
['abc']
History
Date User Action Args
2007年08月23日 14:18:38adminlinkissue852532 messages
2007年08月23日 14:18:38admincreate

AltStyle によって変換されたページ (->オリジナル) /