Re: what happens when the file begin read is too big for all lines tobe?read with readlines()

2005-11-20 Thread Ross Reyes
Yes, I have read this part

  readlines( [sizehint])

Read until EOF using readline() and return a list containing the lines thus 
read. If the optional sizehint argument is present, instead of reading up to 
EOF, whole lines totalling approximately sizehint bytes (possibly after 
rounding up to an internal buffer size) are read. Objects implementing a 
file-like interface may choose to ignore sizehint if it cannot be 
implemented, or cannot be implemented efficiently.

Maybe I'm missing the obvious, but it does not seem to say what happens when 
the input for readlines is too big.  Or does it?

How does one tell exactly what the limitation is to the size of  the 
returned list of strings?

- Original Message - 
From: Ben Finney [EMAIL PROTECTED]
Newsgroups: comp.lang.python
To: python-list@python.org
Sent: Saturday, November 19, 2005 6:48 AM
Subject: Re: what happens when the file begin read is too big for all lines 
tobe?read with readlines()


 Ross Reyes [EMAIL PROTECTED] wrote:
 Sorry for maybe a too simple a question but I googled and also
 checked my reference O'Reilly Learning Python book and I did not
 find a satisfactory answer.

 The Python documentation is online, and it's good to get familiar with
 it:

URL:http://docs.python.org/

 It's even possible to tell Google to search only that site with
 site:docs.python.org as a search term.

 When I use readlines, what happens if the number of lines is huge?
 I have a very big file (4GB) I want to read in, but I'm sure there
 must be some limitation to readlines and I'd like to know how it is
 handled by python.

 The documentation on methods of the 'file' type describes the
 'readlines' method, and addresses this concern.

URL:http://docs.python.org/lib/bltin-file-objects.html#l2h-244

 -- 
 \ If you're not part of the solution, you're part of the |
  `\   precipitate.  -- Steven Wright |
 _o__)  |
 Ben Finney
 -- 
 http://mail.python.org/mailman/listinfo/python-list 
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: what happens when the file begin read is too big for all lines tobe?read with readlines()

2005-11-20 Thread Mike Meyer
Ross Reyes [EMAIL PROTECTED] writes:

 Yes, I have read this part
 How does one tell exactly what the limitation is to the size of  the
 returned list of strings?

There's not really a good platform-indendent way to do that, because
you'll get memory until the OS won't give you any more.

   mike
-- 
Mike Meyer [EMAIL PROTECTED]  http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
-- 
http://mail.python.org/mailman/listinfo/python-list