Reference

Steven D'Aprano steve at pearwood.info
Tue Mar 4 04:45:55 CET 2014


On Mon, 03 Mar 2014 13:48:39 -0500, Terry Reedy wrote:

> 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.


+1 QOTW 



-- 
Steven



More information about the Python-list mailing list