Passing list with flexible length to C extension

Michael Hudson mwh at
Fri Nov 21 14:37:08 CET 2003

Boštjan Jerko <bostjan.jerko at> writes:

> Is there a way to pass list with flexible length to C extension?

Yes, although I'm not quite sure what you mean.  Do you want to be
able to type

my_ext_func([3.0, 1.0, 4.0, 1.0, 5.0])


my_ext_func(3.0, 1.0, 4.0, 1.0, 5.0)

?  If the latter you can't use PyArg_ParseTuple, but the `args'
parameter is just a tuple, amenable to PyTuple_Length & so on.


  Our Constitution never promised us a good or efficient government,
  just a representative one. And that's what we got.

More information about the Python-list mailing list