Re: extending Python - passing nested lists

2008-01-29 Thread Arnaud Delobelle
On Jan 29, 4:00 pm, Christian Meesters <[EMAIL PROTECTED]> wrote: > > You didn't mention speed in your original post. > > Sorry, perhaps I considered this self-evident - which it is, of course, not. > > > What about using > > array.array?  Unless I am mistaken, these are just a thin wrapper > > aro

Re: extending Python - passing nested lists

2008-01-29 Thread Mel
Christian Meesters wrote: >> You didn't mention speed in your original post. > Sorry, perhaps I considered this self-evident - which it is, of course, not. > >> What about using >> array.array? Unless I am mistaken, these are just a thin wrapper >> around normal C arrays. > The algorithm I want

Re: extending Python - passing nested lists

2008-01-29 Thread Christian Meesters
> You didn't mention speed in your original post. Sorry, perhaps I considered this self-evident - which it is, of course, not. > What about using > array.array? Unless I am mistaken, these are just a thin wrapper > around normal C arrays. The algorithm I want to implement requires several millio

Re: extending Python - passing nested lists

2008-01-29 Thread Arnaud Delobelle
On Jan 29, 1:22 pm, Christian Meesters <[EMAIL PROTECTED]> wrote: > Thanks. Point is that all such approaches would require lots(!) of calls to > the Python API - a way by which I won't gain the desired speed. You didn't mention speed in your original post. What about using array.array? Unless I

Re: extending Python - passing nested lists

2008-01-29 Thread Christian Meesters
Thanks. Point is that all such approaches would require lots(!) of calls to the Python API - a way by which I won't gain the desired speed. I've tried pyrex and the corresponding C-file is so convoluted with dummy variables, incrementing & decrementing references, and other stuff, that I want to

Re: extending Python - passing nested lists

2008-01-29 Thread Arnaud Delobelle
On Jan 29, 12:48 pm, Christian Meesters <[EMAIL PROTECTED]> wrote: > Think, that I'm still at the wrong track. Point is that I cannot find any > examples and don't know where to start here. > Perhaps my problem boils down to two questions: > I'd like to pass lists (in some cases nested ones) from P

Re: extending Python - passing nested lists

2008-01-29 Thread Christian Meesters
Think, that I'm still at the wrong track. Point is that I cannot find any examples and don't know where to start here. Perhaps my problem boils down to two questions: I'd like to pass lists (in some cases nested ones) from Python to C and convert those Python-lists to C-arrays (e. g. of doubles). M

Re: extending Python - passing nested lists

2008-01-28 Thread Christian Meesters
Mark Dickinson wrote: > Well, it's pretty clear: you misspelt "length" as "lenght". :) Well, that's not it ;-). (Damn copy & paste plague ...) > > PySequence_Fast doesn't return an array: it returns a PyObject---in > this case, a PyObject corresponding to a Python tuple. That's it. Thanks. Thi

Re: extending Python - passing nested lists

2008-01-28 Thread Mark Dickinson
On Jan 28, 10:10 am, Christian Meesters <[EMAIL PROTECTED]> wrote: > Hi, > > I would like to write a C-extension function for an application of mine. For > this I need to pass a nested list (like: [[a, b, c], [d, e, f], ...], where > all letters are floats) to the C-function. Now, with the code I h

extending Python - passing nested lists

2008-01-28 Thread Christian Meesters
Hi, I would like to write a C-extension function for an application of mine. For this I need to pass a nested list (like: [[a, b, c], [d, e, f], ...], where all letters are floats) to the C-function. Now, with the code I have the compiler is complaining: "subscripted value is neither array nor poi