[Tutor] Re: Linked Lists

Kalle Svensson kalle@gnupung.net
Tue, 20 Mar 2001 16:28:15 +0100


Sez VanL:
> Say, for instance, that you have a 10MB file.  Is readlines() smart
> enough to not load the whole thing into
> memory at once?  I know that readline() will only return one line,
> but it was my impression that it was a one-at a time dispatching
> from an in-memory list.

IIRC:
read() and readline() read directly from the file, not from memory.
readlines() reads the entire file into memory.
xreadlines() (new in 2.1) reads a line at a time (or something), but
supports the list interface.

Peace,
  Kalle
-- 
Email: kalle@gnupung.net     | You can tune a filesystem, but you
Web: http://www.gnupung.net/ | can't tune a fish. -- man tunefs(8)
PGP fingerprint: 0C56 B171 8159 327F 1824 F5DE 74D7 80D7 BF3B B1DD
 [ Not signed due to lossage.  Blame Microsoft Outlook Express. ]