Too big of a list? and other problems

Terry Reedy tjreedy at udel.edu
Tue May 23 02:45:54 CEST 2006


"Brian" <bnblazer at gmail.com> wrote in message 
news:1148343552.037687.214420 at j55g2000cwa.googlegroups.com...
> First off, I am sorry for cluttering this group with my inept
> questions, but I am stuck again despite a few hours of hair pulling.
>
> I have a function (below) that takes a list of html pages that have
> images on them (not porn but boats).  This function then (supposedly)
> goes through and extracts the links to those images and puts them into
> a list, appending with each iteration of the for loop.  The list of
> html pages is 82 items long and each page has multiple image links.
> When the function gets to item 77 or so, the list gets all funky.
> Sometimes it goes empty, and others it is a much more abbreviated list
> than I expect - it should have roughly 750 image links.

This does not make much sense without actual examples.   But ...

> When I looked at it while running, it appears as if my regex is
> actually appending a tuple (I think) of the results it finds to the
> list.

because that is what you said to do.  So foundpics will have 1 items 
appended per page.  I am sure you want to .extend the list with the 
sequence returned by findall, not append.

> My best guess is that the list is getting too big and croaks.

Almost certainly not, unless you are out of memory, in which case you 
should get appropriate exception.  If suggested edit is not enough, print 
the results of findall and even of foundPics with every iteration to 
investigate further.  Add input statement so you can step thru iterations 
(perhaps after 50th or so).

Terry Jan Reedy 






More information about the Python-list mailing list