I was looking at the source code to the hasattr built-in function and noticed a couple of lines that piqued my interest:
Py_INCREF(Py_False);
return Py_False;
...
Py_INCREF(Py_True);
return Py_True;
Aren't Py_False
and Py_True
global values? Just out of sheer curiosity, why is Python keeping a reference count for these variables?