Sujet : Re: Which newsgroup for json parsing?
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.lang.cDate : 05. Aug 2024, 03:55:13
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v8peuh$fi30$5@dont-email.me>
References : 1 2 3 4 5 6 7 8
User-Agent : Pan/0.159 (Vovchansk; )
On Tue, 28 May 2024 14:45:09 +0300, Michael S wrote:
And despite that you can very easily have too much (or too many?)
comments.
My rule with comments is that they should explain *why* the code is doing
what it’s doing, not simply repeat *what* the code is doing (which would
be obvious to anyone who knows the language, APIs etc).
E.g.
const ssize_t allocation_step = 10;
/* something convenient to reduce nr of tuple resize operations */
...
PyTuple_SET_ITEM(factorelt, 0, factorobj);
PyTuple_SET_ITEM(factorelt, 1, powerobj);
factorobj = powerobj = NULL; /* ownership has passed to factorelt */
if (nr_used == nr_allocated)
{
/* need more room in result tuple */
nr_allocated += allocation_step;
if (_PyTuple_Resize(&tempresult, nr_allocated) != 0)
break;
} /*if*/