Jerry Hill <malaclyp...@gmail.com>:

> except for the fact that there has been 20 years of custom saying that
> comparing to None with equality is wrong.

"if foo == None" is not wrong in any manner. It's just that if you are
comfortable with the "is" operator and its semantics, "if foo is None"
is slightly more natural.

You generally use "==" if more than one object could be equal. If you
know there's only one object of the kind, you convey that knowledge by
the use of "is" even when functionally, it doesn't matter.


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to