Inlined C code and a TypeError

Ognen Duzlevski maketo at vinland.freeshell.org
Tue Jan 13 10:44:08 EST 2004


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



More information about the Python-list mailing list