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

sessile@in-gen.net sessile@in-gen.net
Sat, 06 Nov 1999 22:24:20 -0500


I've poked around in the Python/C API Reference Manual
hoping to find an explanation, but all those words are
making my brain hurt... perhaps due to my illiteracy in
'C', I find the API manual to be rather cryptic.

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.  Is there
a 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,
Dean.
--
E-Mail:  sessile@in-gen.net
  "I don't want the world... I just want your half."
                   -- TMBG (Anna Ng)