how to handle large lists?

Please support our Python advertiser: Programming Forums - DaniWeb Sister Site
Reply

Join Date: May 2008
Posts: 1
Reputation: athirar is an unknown quantity at this point 
Solved Threads: 0
athirar athirar is offline Offline
Newbie Poster

how to handle large lists?

 
0
  #1
May 19th, 2008
While executing programs with large lists ,i am encountering an error message:
Index error:List index out of range
The program works well with small lists..Can anyone suggest me some efficient methods to handle this problem?or Is there any other efficient datastructure other than lists and dictionary to serve the purpose ?
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 671
Reputation: Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough 
Solved Threads: 113
Freaky_Chris's Avatar
Freaky_Chris Freaky_Chris is offline Offline
Practically a Master Poster

Re: how to handle large lists?

 
0
  #2
May 19th, 2008
you could split your list in to 2 smaller lists and process them indervidualy.

Also you may wish to look into vectors

Chris
Reply With Quote Quick reply to this message  
Join Date: Aug 2005
Posts: 1,546
Reputation: Ene Uran has a spectacular aura about Ene Uran has a spectacular aura about 
Solved Threads: 174
Ene Uran's Avatar
Ene Uran Ene Uran is offline Offline
Posting Virtuoso

Re: how to handle large lists?

 
0
  #3
May 19th, 2008
I don't think it has much to do with the size of the list, you are simply going past the number of indexed elements. Look at this example:
  1. my_list = [1, 2, 3, 4]
  2. print my_list[4] # IndexError: list index out of range
drink her pretty
Reply With Quote Quick reply to this message  
Join Date: Apr 2008
Posts: 671
Reputation: Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough Freaky_Chris is a jewel in the rough 
Solved Threads: 113
Freaky_Chris's Avatar
Freaky_Chris Freaky_Chris is offline Offline
Practically a Master Poster

Re: how to handle large lists?

 
0
  #4
May 19th, 2008
that is what i was thinking, but i was also thinking that it works fine for shorter lists, so i was guessing he wouldn't actual do that

Chris
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1,028
Reputation: woooee is a jewel in the rough woooee is a jewel in the rough woooee is a jewel in the rough 
Solved Threads: 289
woooee woooee is offline Offline
Veteran Poster

Re: how to handle large lists?

 
0
  #5
May 20th, 2008
"list index out of range" has nothing to do with the size of the list AFAIK. If the list were too large there would be some sort of out of memory message.
Is there any other efficient datastructure other than lists and dictionary to serve the purpose ?
SQLite can be used in memory but you'll have to provide some more info on how many records you want to store, what is the size of each record, and what you want to do in order to be more specific.
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 37
Reputation: kdoiron is an unknown quantity at this point 
Solved Threads: 3
kdoiron's Avatar
kdoiron kdoiron is offline Offline
Light Poster

Re: how to handle large lists?

 
0
  #6
May 22nd, 2008
I have to agree with EneUran - the size of the list is, or at least should be, irrelevant.

Athirar, can you post a code sample and your list?
But I don't like SPAM!
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Python Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC