User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Python section within the Software Development category of DaniWeb, a massive community of 422,412 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 5,041 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Python advertiser: Programming Forums
Views: 282 | Replies: 5
Reply
Join Date: May 2008
Posts: 1
Reputation: athirar is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
athirar athirar is offline Offline
Newbie Poster

how to handle large lists?

  #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 ?
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Apr 2008
Posts: 113
Reputation: Freaky_Chris is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 10
Freaky_Chris's Avatar
Freaky_Chris Freaky_Chris is online now Online
Junior Poster

Re: how to handle large lists?

  #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  
Join Date: Aug 2005
Posts: 1,107
Reputation: Ene Uran is an unknown quantity at this point 
Rep Power: 6
Solved Threads: 66
Ene Uran's Avatar
Ene Uran Ene Uran is offline Offline
Veteran Poster

Re: how to handle large lists?

  #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  
Join Date: Apr 2008
Posts: 113
Reputation: Freaky_Chris is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 10
Freaky_Chris's Avatar
Freaky_Chris Freaky_Chris is online now Online
Junior Poster

Re: how to handle large lists?

  #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  
Join Date: Dec 2006
Posts: 443
Reputation: woooee is on a distinguished road 
Rep Power: 2
Solved Threads: 62
woooee woooee is offline Offline
Posting Pro in Training

Re: how to handle large lists?

  #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  
Join Date: May 2008
Location: Toronto
Posts: 37
Reputation: kdoiron is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 2
kdoiron's Avatar
kdoiron kdoiron is offline Offline
Light Poster

Re: how to handle large lists?

  #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  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Python Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Python Forum

All times are GMT -4. The time now is 9:26 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC