setup() and C extensions

Carsten Haese carsten at uniqsys.com
Tue Apr 10 09:23:05 EDT 2007


On Mon, 2007-04-09 at 23:35 -0700, 7stud wrote:
> 2) When returning None, why use the idiom:
> 
> Py_INCREF(Py_None);
> return Py_None;
> 
> instead of:
> 
> return Py_BuildValue("");
> 

As Gabriel said, the preferred idiom is faster and clearer. Sufficiently
recent Pythons define the macro Py_RETURN_NONE for the preferred idiom.

-Carsten





More information about the Python-list mailing list