[issue6616] PyList_APPEND (append without incref)
Campbell Barton
report at bugs.python.org
Sun Aug 2 05:02:15 CEST 2009
Campbell Barton <ideasman42 at gmail.com> added the comment:
Hi Raymond, in general I agree with your comments that adding 2 ways to
do things is not great. The reason I still think this is an advantage is
that I know the API well enough (with manipulating dicts/lists etc) and
I still want this function for the sake of convenience.
For the same reason that PyList_SET_ITEM is useful, this is useful too.
Loosing the error checking is a disadvantage but in many cases API's
dont do error checking for every new item allocated.
Python's own code does this in a few cases with PyList_SET_ITEM...
eg.
./Python/_warnings.c:857: PyList_SET_ITEM(filters, 1,
create_filter(PyExc_ImportWarning, "ignore"))
./Python/Python-ast.c:2757: PyList_SET_ITEM(value, i,
ast2obj_cmpop((cmpop_ty)asdl_seq_GET(o->v.Compare.ops, i)));
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue6616>
_______________________________________
More information about the Python-bugs-list
mailing list