GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — codeql/python/ql/src/Expressions/EqualsNone.qhelp at codeql-cli/v2.19.1 · github/codeql Expand file tree/ Copy pathEqualsNone.qhelpMore file actions 34 lines (23 loc) · 1.02 KB / Copy pathEqualsNone.qhelpFile metadata and controls34 lines (23 loc) · 1.02 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 <!DOCTYPE qhelp PUBLIC "-//Semmle//qhelp//EN" "qhelp.dtd"> <qhelp> <overview> <p> When you compare an object to <code>None</code>, use <code>is</code> rather than <code>==</code>. <code>None</code> is a singleton object, comparing using <code>==</code> invokes the <code>__eq__</code> method on the object in question, which may be slower than identity comparison. Comparing to <code>None</code> using the <code>is</code> operator is also easier for other programmers to read.</p> </overview> <recommendation> <p>Replace <code>==</code> with <code>is</code>.</p> </recommendation> <example> <p>The <code>filter2</code> function is likely to be more efficient than the <code>filter1</code> function because it uses an identity comparison.</p> <sample src="EqualsNone.py" /> </example> <references> <li>Python Language Reference: <a href="http://docs.python.org/reference/expressions.html#is">Comparisons</a>, <a href="http://docs.python.org/reference/datamodel.html#object.__eq__">object.__eq__</a>.</li> </references> </qhelp> |
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |