<[EMAIL PROTECTED]> wrote in message 
news:[EMAIL PROTECTED]
> What's the problem with this code? I get the following error message:

2.4 or earlier?

> File "test.py", line 26, in test
>    print tbl[wi][bi]
> IndexError: index must be either an int or a sequence

Longs are not ints; message implies that Numeric, unlike Python, does not 
allow them as indexes.

> from Numeric import *
> tbl = zeros((32, 16))
>
> def test():
>
>    val = testme()

val is never used

>    wi = crc >> 4

crc is never set, so how did this run?

>    bi = crc & 0xFL

making bi a long.  Try 0xF which should be faster anyway.

>    print wi
>    print bi
print type(wi), type(bi)
>    print tbl[wi][bi]
>
> def testme():
>    val = 0xFFFFFFL
>    val >>= 23
>    return val
>
> if __name__ == '__main__':
>    test()



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to