is None or == None ?

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Sat Nov 7 10:05:26 EST 2009


On Fri, 06 Nov 2009 16:51:18 +0100, Marco Mariani wrote:

> Using "x is y" with integers
> makes no sense and has no guaranteed behaviour AFAIK

Of course it makes sense. `x is y` means *exactly the same thing* for 
ints as it does with any other object: it tests for object identity. 
That's all it does, and it does it perfectly.

Python makes no promise whether x = 3; y = 3 will use the same object for 
both x and y or not. That's an implementation detail. That's not a 
problem with `is`, it is a problem with developers who make unjustified 
assumptions.


-- 
Steven



More information about the Python-list mailing list