FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
codeql/python/ql/src/Functions/NonSelf.qhelp at codeql-cli-2.11.3 · github/codeql · GitHub
github
/
codeql
Public
Notifications
You must be signed in to change notification settings
Fork
2.1k
Star
10.1k
Code
Issues
1k
Pull requests
468
Discussions
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Discussions
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
codeql
/
python
/
ql
/
src
/
Functions
/
NonSelf.qhelp
Copy path
More file actions
More file actions
Latest commit
History
History
History
38 lines (28 loc) · 1.17 KB
Breadcrumbs
codeql
/
python
/
ql
/
src
/
Functions
/
NonSelf.qhelp
Copy path
File metadata and controls
38 lines (28 loc) · 1.17 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
35
36
37
38
<!
DOCTYPE
qhelp
PUBLIC
"-//Semmle//qhelp//EN"
"qhelp.dtd">
<
qhelp
>
<
overview
>
<
p
> Normal methods should have at least one parameter and the first parameter should be called <
code
>self</
code
>.
This makes the purpose of the parameter clear to other developers.
</
p
>
</
overview
>
<
recommendation
>
<
p
>If there is at least one parameter, then change the name of the first parameter to <
code
>self</
code
> as recommended by the style guidelines
in PEP 8.</
p
>
<
p
>If there are no parameters, then it cannot be a normal method. It may need to be marked as a <
code
>staticmethod</
code
>
or it could be moved out of the class as a normal function.
</
p
>
</
recommendation
>
<
example
>
<
p
>The following methods can both be used to assign values to variables in a <
code
>point</
code
>
object. The second method makes the association clearer because the <
code
>self</
code
> parameter is
used.</
p
>
<
sample
src
=
"
NonSelf.py
"
/>
</
example
>
<
references
>
<
li
>Python PEP 8: <
a
href
=
"
http://www.python.org/dev/peps/pep-0008/#function-and-method-arguments
"
>Function and
method arguments</
a
>.</
li
>
<
li
>Python Tutorial: <
a
href
=
"
http://docs.python.org/2/tutorial/classes.html
"
>Classes</
a
>.</
li
>
</
references
>
</
qhelp
>
Back
|
FazBrowse Home
|
New Git URL