Here's the doc: https://docs.python.org/2/reference/expressions.html#is It would be great if this line: "The operators is and is not test for object identity: x is y is true if and only if x and y are the same object. x is not y yields the inverse truth value.[7]" Could link to the id() builtin doc: https://docs.python.org/2/library/functions.html#id One way to rephrase this could be: "The operators is and is not test for object identity: x is y is true if and only if x and y are the same object or id(x) == id(y). x is not y yields the inverse truth value.[7]" And, the id's can be hyperlinks. It would also be nice if that reference linked to a page on integer caching in Python.
There is not 'integer caching in Python'. This is strictly an implementation feature of CPython, and any other implementation that does similarly. "or id(x) == id(y)" should be "(id(x) == id(y))" as the addition is an alternate wording, not an alternate condition. I am not sure that this will always be helpful.
Please don’t use nested brackets like that in English text. Try to rewrite the sentence without brackets (e.g. use a comma or say “This is equivalent to”) [or use a different kind of bracket if you really must (to make the nesting clearer)].
I agree with the OP that is would be useful to link to id(). I also concur with Terry that integer caching is to remain an undocumented implementation specific detail (just an optimization). Also, Martin is correct that the proposed wording doesn't read well.