how to read a list from python in C?

skip at pobox.com skip at pobox.com
Fri May 19 10:05:10 EDT 2006


    Lialie> I am writing a C extension with .Net.  Now I have a list of
    Lialie> points, like [(0.0, 0.0), (2.0, 3.0), (random x, random y)....].
    Lialie> Is there a better way to translate it to an array than doing it
    Lialie> one by one?

Are you passing a list as an argument to one of the functions in your C
extension module?  If so, yup, you get the list argument and march through
it element-by-element, then march through those tuples.  For more detail on
argument handling in C, read here:

    http://www.python.org/doc/api/arg-parsing.html

Skip



More information about the Python-list mailing list