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

sessile at sessile at
Tue Nov 9 03:12:17 CET 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?  



More information about the Python-list mailing list