is None or == None ?

Marco Mariani marco at
Fri Nov 6 15:13:14 CET 2009

Alf P. Steinbach wrote:

> As I understand it, 'is' will always work and will always be efficient 
> (it just checks the variable's type), while '==' can depend on the 
> implementation of equality checking for the other operand's class.

"== None" makes sense, for instance, in the context of the SQLAlchemy 
sql construction layer, where the underlying machinery defines __eq__() 
/ __ne__() and generates the appropriate 'IS NULL' SQL code when 

More information about the Python-list mailing list