Re: Maximum List size (item number) limit?



Kriston-Vizi Janos wrote:
Dear Mr. Kern, and Members,

Thank you very much for the fast answer, my question became over-simplified.

My source code is appended below. It uses two text files (L.txt and GC.txt) as input and merges them.

Both L.txt and GC.txt contains 3000 rows. When running, the code stops with error message:

'The debugged program raised the exception IndexError "list index out of range"
File: /home/kvjanos/file.py, Line: 91'


And I noticed that all the lists that should contain 3000 items, contains less as follows:
NIR_mean_l = 1000 items

Code that's failing:

# Processing L file
line_no_l =0 # Input L file line number
type_l = 1 # Input L file row type: 1 (row n),2 (row n+1) or 3 (row n+2)
# Append L values to lists.
for line in inp_file_l.xreadlines():
line_no_l = line_no_l + 1
if line_no_l == 1: # To skip the header row
continue data_l = [] # An L row data_l = line.split()
if type_l == 1: NIR_mean_l.append(data_l[2]) # Append 3rd item of the row to the list
NIR_stdev_l.append(data_l[3]) # Append 4th item of the row to the list
type_l = 2 # Change to row n+1
else:
if type_l == 2:
R_mean_l.append(data_l[2])
R_stdev_l.append(data_l[3])
type_l = 3
else:
G_mean_l.append(data_l[2])
G_stdev_l.append(data_l[3]) area_l.append(data_l[1]) type_l = 1
inp_file_l.close()



Looking at the data files, it seems there is no header row to skip. Skipping 1st row seems to cause the discrepancy of vector sizes, which leads to the IndexError. should NIR_mean_l[0] be 203 or 25?

As the comments in your code suggest, the code adds values to
NIR_mean_l only from lines 1, 4, 7, ...
R_mean_l only from lines 2, 5, 8, ...
G_mean_l only from lines 3, 6, 9, ...
Try with 12 lines of input data and see how the vectors
are 4 elements before filtering/writing.
.



Relevant Pages

  • Re: Static/Strong/Implicit Typing
    ... >> accept both lists and vectors. ... >> you define a function that operates on source code. ... In a H-M-ish type system, ... >> a design for a statically typed Lisp that wouldn't feel ...
    (comp.lang.lisp)
  • Re: Source Code Wiki Start-Up Community
    ... migrating code-snippets and source code into it over the last few ... lists of pixels. ... newly-found pixels getting put on the second. ... a typical stack) will fail gracefully if it runs out of memory. ...
    (comp.programming)
  • Re: unexpected behaviour
    ... you are modifying the source code of your program! ... (defun my-eval (sexp) ... That means that you are modifying the function itself. ... which consists of data in the form of lists. ...
    (comp.lang.lisp)
  • handbook - kernel build question
    ... In section 9.3 of the handbook just before the two procedures it lists ... "If you are building a new kernel without updating the source code ... Are the words update and upgrade the ... we are free to abandon sin." ...
    (freebsd-questions)
  • Re: Static/Strong/Implicit Typing
    ... > Then I can't use the sequence functions of Common Lisp that ... > accept both lists and vectors. ... calls to the appropriate ones (since it has all the static type information ... > you define a function that operates on source code. ...
    (comp.lang.lisp)