Can't use len() on returned PyList object?

sessile at in-gen.net sessile at in-gen.net
Mon Nov 8 21:12:17 EST 1999


Why can't I use 'len()' to find the length of a list
returned from my new extension module?  The error is
shown as:

    TypeError: call of non-function (type int)

The list was created by 'PyList_New()' and populated
using 'PyList_SetItem()'.  I get the same error message
regardless of the data type held in the list.  I can
access each element of the list just fine, but I don't
always know how many there are.  Is there a reasonable
way for me to find the length of these lists in Python
other than returning the length from the extension as a
separate object?  

Python-1.5.2
SunOS-5
gcc-2.7.1

Thanks.





More information about the Python-list mailing list