Frans Englich schrieb:
What is the equivalent expression which is more secure; `!= None`?
Note that this is not necessarily equivalent. '!=' and '==' possibly run
method calls on objects which can be costly depending on their
implementation and can even raise exceptions if called with None. If I
[Stefan Behnel]
Frans Englich schrieb:
What is the equivalent expression which is more secure; `!= None`?
If I want to check for None, I always do it with is. It's a constant
after all...
So do I. There is only one None object, for which an `is' test is
especially appropriate.
--
btw, 'isnot' is not pronounced is-not but rather i-snot. :-)
S
--
http://mail.python.org/mailman/listinfo/python-list
That's what PyChecker tells me, at least.
A line of:
if testReport is not None:
results in:
runner.py:587: Using is not None, may not always work
In what circumstances can `is not None` fail? How and why does it fail?
What is the equivalent expression which is more secure; `!= None`?
Frans Englich wrote:
runner.py:587: Using is not None, may not always work
It's a PyChecker bug relating to None being a constant in 2.4:
http://tinyurl.com/6dexc.
--
http://mail.python.org/mailman/listinfo/python-list
Frans Englich wrote:
That's what PyChecker tells me, at least.
A line of:
if testReport is not None:
results in:
runner.py:587: Using is not None, may not always work
In what circumstances can `is not None` fail? How and why does it fail?
What is the equivalent expression