30 Aug
2005
30 Aug
'05
6:25 p.m.
[Ron Adam]
This would allow creating an iterator that could iterate though a string splitting on each sep from either the left, or right.
For uses more complex than basic partitioning, people should shift to more powerful tools like re.finditer(), re.findall(), and re.split().
I can't think of an obvious use for a partition iterator at the moment, maybe someone could find an example.
I prefer to avoid variants that are searching of a purpose.
In any case, finding the second, or third sep is probably common enough.
That case should be handled with consecutive partitions: # keep everything after the second 'X' head, found, s = s.partition('X') head, found, s = s.partition('x') Raymond