[issue6616] PyList_APPEND (append without incref)

Raymond Hettinger report at bugs.python.org
Sat Aug 1 23:05:21 CEST 2009


Raymond Hettinger <rhettinger at users.sourceforge.net> added the comment:

> This simple patch allows...
>  PyList_APPEND(list, PyFloat_FromDouble(x))

This isn't a good idea because the error checking 
for the inner function is lost.  The current API
encourages keeping one function per line so that 
the ref counting and error-checking are more obvious.

Also, I'm not too keen on adding second-ways-to-do-it.
The C API is already somewhat fat, making it harder
to learn and remember.  The current API has standard
patterns of creating and consuming references.
Introducing variants that don't follow those patterns
makes it harder to review code and determine that it 
is correct.

It is better to learn to use the API as designed than
to commingle two different styles.

----------
nosy: +rhettinger

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6616>
_______________________________________


More information about the Python-bugs-list mailing list