Raymond Hettinger added the comment:
> I know the API well enough (with manipulating dicts/lists etc)
> and I still want this function for the sake of convenience.
Given that your level of skill is higher than the average user,
I recommend adding this to your own standard libraries or headers.
Campbell Barton 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 c
Raymond Hettinger 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-check
New submission from Campbell Barton :
This patch was made on python r74276
Often when writing in C/Python I want to append to a list within a C
loop of an unknown length.
When this is done for newly created PyObject (which is quite common) -
you need to assign each item to a variable and then de