Suggestion: str.itersplit()

Michael Hoffman cam.ac.uk at mh391.invalid
Sat Apr 21 09:28:50 EDT 2007


Marc 'BlackJack' Rintsch wrote:
> In <1177160280.784224.53460 at b58g2000hsg.googlegroups.com>, Dustan wrote:
> 
>> From my searches here, there is no equivalent to java's
>> StringTokenizer in python, which seems like a real shame to me.
>>
>> However, str.split() works just as well, except for the fact that it
>> creates it all at one go. I suggest an itersplit be introduced for
>> lazy evaluation, if you don't want to take up recourses, and it could
>> be used just like java's StringTokenizer.
>>
>> Comments?
> 
> Does it really make such a difference?

It would if you were dealing with enormous blocks of text at once, say 
from a database.
-- 
Michael Hoffman



More information about the Python-list mailing list