Question about Py_Is and ==

In Python when you write a is b, what it does in C is it checks whether pointers of objects point to the same memory location.

Thus, in CPython, equivalent can be written p_a == p_b. Also, a macro exists, which is called Py_Is. And all it does is exactly that:

#define Py_Is(p_a, p_b) ((p_a) == (p_b))

The rest is context specific, which is potential requirements implementing something similar to Backquotes for deferred expression and issues with full integration of such.

2 Likes