Reference

Terry Reedy tjreedy at udel.edu
Mon Mar 3 13:48:39 EST 2014


On 3/3/2014 4:42 AM, ast wrote:

> Consider following code:
>
>>>> A=7
>>>> B=7
>>>> A is B

The 'is' operator has three uses, two intended and one not. In 
production code, 'is' tests that an object *is* a particular singular 
object, such as None or a sentinel instance of class object. In test 
code, 'is' can also be used to test details of a particular 
implementation, such as pre-allocation of small ints. New python 
programmers also use it to confuse themselves.

-- 
Terry Jan Reedy




More information about the Python-list mailing list