mirror of
https://github.com/github/codeql.git
synced 2025-12-31 16:16:34 +01:00
36 lines
1.4 KiB
XML
36 lines
1.4 KiB
XML
<!DOCTYPE qhelp PUBLIC
|
|
"-//Semmle//qhelp//EN"
|
|
"qhelp.dtd">
|
|
<qhelp>
|
|
<overview>
|
|
<p>
|
|
Using a named argument whose name does not correspond to a parameter of the <code>__init__</code> method of the class being instantiated, will result in a
|
|
<code>TypeError</code> at runtime.
|
|
</p>
|
|
|
|
</overview>
|
|
<recommendation>
|
|
|
|
<p>Check for typos in the name of the arguments and fix those.
|
|
If the name is clearly different, then this suggests a logical error.
|
|
The change required to correct the error will depend on whether the wrong argument has been
|
|
specified or whether the wrong class has been specified.
|
|
</p>
|
|
|
|
</recommendation>
|
|
<example>
|
|
<sample src="WrongNameForArgumentInClassInstantiation.py"/>
|
|
</example>
|
|
|
|
<references>
|
|
|
|
<li>Python Glossary: <a href="https://docs.python.org/2/glossary.html#term-argument">Arguments</a>.</li>
|
|
<li>Python Glossary: <a href="https://docs.python.org/glossary.html#term-parameter">Parameters</a>.</li>
|
|
<li>Python Programming FAQ: <a href="https://docs.python.org/2/faq/programming.html#faq-argument-vs-parameter">
|
|
What is the difference between arguments and parameters?</a>.</li>
|
|
<li>The Python Language Reference: <a href="https://docs.python.org/3/reference/datamodel.html#object.__init__">Data model: object.__init__</a></li>
|
|
<li>The Python Tutorial: <a href="https://docs.python.org/3/tutorial/classes.html">Classes</a></li>
|
|
|
|
</references>
|
|
</qhelp>
|