Hi!

The following happens on Intel(R) Core(TM)2 CPU, openSUSE 11.0
(X86-64), sage 4.1.
It does not happen on sage.math.

Consider the following code in listtext.pyx:
def ListTest(int n):
    cdef dict D = dict(zip(range(1,n+1),range(n)))
    cdef list L = n*[0]
    cdef int i
    for i from 0<i<=n:
        print len(L), D[i]
        print L[D[i]]
        L[D[i]] = D[i]

Now, start sage and do

sage: attach listtest.pyx
Compiling /home/king/SPKG/tests/listtest.pyx...
sage: ListTest(10)
10 0
0
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (355, 0))

---------------------------------------------------------------------------
IndexError                                Traceback (most recent call
last)

/home/king/.sage/temp/gauss/16047/_home_king__sage_init_sage_0.py in
<module>()

/home/king/.sage/temp/gauss/16047/spyx/
_home_king_SPKG_tests_listtest_pyx/
_home_king_SPKG_tests_listtest_pyx_0.so in
_home_king_SPKG_tests_listtest_pyx_0.ListTest
(_home_king_SPKG_tests_listtest_pyx_0.c:576)()
     11         print len(L), D[i]
     12         print L[D[i]]
---> 13         L[D[i]] = D[i]
     14
     15

IndexError: list assignment index out of range


Why is the index 0 out of range, for a list of length 10? Why can I
read from L[D[i]], but not assign to it? And why is the error
different (without the "EOF in multi line statement" bit) if the line
  print L[D[i]]
is removed? Is somebody able to reproduce the problem?

Best regards,
Simon
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to