On Mon, Aug 06, 2007, Guido van Rossum wrote:
>
> I've always made a point of suggesting that we're switching to
> returning iterators instead of lists from as many APIs as makes sense
> (I stop at str.split() though, as I can't think of a use case where
> the list would be so big as to be bothersome).
s = ('123456789' * 10) + '\n'
s = s * 10**9
s.split('\n')
Now, maybe we "shouldn't" be processing all that in memory, but if your
argument applies to other things, I don't see why it shouldn't apply to
split(). Keep in mind that because split() generates a new string for
each line, that really does eat lots of memory, even if you switch to
10**6 instead of 10**9, which seems like a very common use case.
--
Aahz ([EMAIL PROTECTED]) <*> http://www.pythoncraft.com/
This is Python. We don't care much about theory, except where it intersects
with useful practice.
_______________________________________________
Python-3000 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe:
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com