Inlined C code and a TypeError

O

Ognen Duzlevski

Hi all,

I have a nested loop that is written using PyInline for speed reasons. It modifies three matrices (lists of lists
containing integer numbers).

Upon return from this function I run min() on values from the matrices. Below is the puzzling output:

--
time in nested loop: 0.250000
403
394
402
<type 'int'>
<type 'int'>
<type 'int'>
Traceback (most recent call last):
File "./primegens_old.py", line 1656, in ?
GetSegment()
File "./primegens_old.py", line 1499, in GetSegment
tmp_score,sim = SeqMapping(seq[ndx1],seq[0],seqmapping,inversemapping,length[ndx1],length[0])
File "./primegens_old.py", line 678, in SeqMapping
minscore = min(delmat[tlen][qlen], insertmat[tlen][qlen], scoremat[tlen][qlen])
TypeError: an integer is required
--

I do not understand - the numbers 403, 394 and 402 are results of printing the delmat, insertmat and
scoremat[tlen][qlen] each. The "<type 'int'> is a result of calling type on each of these. Yet, when min is called, ot
dies with the TypeError. Can anyone shed some light on this?

Thank you,
Ognen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,020
Latest member
GenesisGai

Latest Threads

Top