Candidate for a new itertool
bearophileHUGS at lycos.com
bearophileHUGS at lycos.com
Mon Mar 9 08:35:11 EDT 2009
Raymond Hettinger:
>In your experiences with xsplit(), do most use cases involve removing the separators?<
Unfortunately I am not able to tell you how often I remove them. But
regarding strings, I usually want to remove separators:
>>> "aXcdXfg".split("X")
['a', 'cd', 'fg']
So sometimes I want to do the same with lists too.
Maybe I am also a bit spoiled by the D (V.1) language, where strings
are dynamic arrays, so you can use the same templated functions for
arrays and strings, so a xsplit() works on both.
>>Is it useful to merge successive separators (notice two X)?<<
>Probably depends on real-world use cases. Do you have any?<
I don't think so.
Bye and thank you for your work that keeps shrinking my bag of tricks
(about 100+ functions to go),
bearophile
More information about the Python-list
mailing list