prosswa, 30.04.2010 00:15:
Depends on what you do with it. If you want to return it to Python space (a
"def" function suggests that), you must either copy it into something that
Python code can deal with (e.g. a list of floats), or wrap it in an
extension class that guards the pointer, controls access to it, and frees
the memory in its __dealloc__ method. Depending on your use case, the first
(certainly simpler) approach might be useful, but in most cases, you will
want to do the latter for performance reasons, especially if you want to
pass the array back into C code later on.
Stefan