best "void" return of a member function
tjreedy at udel.edu
Mon Apr 20 20:30:52 CEST 2009
Andreas Otto wrote:
> I'm writing a native language binding for a library.
> Every native method called by PYTHON have to return
> a PyObject* even if the function itself does not
> return anything.
> I have 2 possibilities for return a PyObject*
> 1. the first argument of the method function
> -> return self;
> 2. an entire new empty object
> -> return Py_BuildValue("");
> Question: what is the best return statement for a "void" function ?
> P.S: NULL is not allowed, because NULL is returned in the case
> of an "error"
To provide a Pythonic interface, error returns should often be converted
to Python exceptions.
More information about the Python-list