[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
_______________________________________________
Python-Dev mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe:
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com