[docs] Python 2.7: inconsistency in "Extending Python with C or C++" example code

Fred Drake fdrake at acm.org
Mon Nov 22 05:24:14 CET 2010


On Fri, Nov 12, 2010 at 2:27 PM, Jani Poikela <poppis.poikela at gmail.com> wrote:
> in chapters 1.1 and 1.3 the example code has:
>    return Py_BuildValue("i", sts);
> whereas chapter 1.2 example code has:
>    return PyLong_FromLong(sts);

I suspect this is simply style changing over time.  My own preference
is to use PyLong_FromLong(...), since that executes slightly less code
than the Py_BuildValue(...) approach, and I find it more readable as
well.


  -Fred

--
Fred L. Drake, Jr.    <fdrake at acm.org>
"A storm broke loose in my mind."  --Albert Einstein


More information about the docs mailing list