4 ms·
Python also keeps refcounts for other objects that shouldn't be garbage collected such as None, True, and False. The reason being to prevent having certain obje
by j_baker 12y ago
Python also keeps refcounts for other objects that shouldn't be garbage collected such as None, True, and False. The reason being to prevent having certain objects that need to be refcounted and certain objects that don't. Otherwise, C code would be littered with if statements like the below:
if (number < -5 || number > 256) {
decrement_refcount(number);
}
- Pxtl 12y agoTo be fair, you'd expect that to live in decrement_refcount.