Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 50aaa31

Browse files
Added Common Rules for Naming Convention in PyBasics-1.ipynb
1 parent 44874a3 commit 50aaa31

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

‎basic/PyBasics-1.ipynb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,23 @@
8888
"- camelCase\n",
8989
"- CapWords\n",
9090
"\n",
91+
"**Common Rules for Naming Convention**\n",
92+
"\n",
93+
"1. If an identifier starts with an underscore, then it is a private identifier\n",
94+
"2. Class names should normally use the CapWords convention. Exp: class BankAccount:\n",
95+
"3. Modules should have short, all-lowercase names. Underscores can be used in the module name if it improves readability.\n",
96+
"4. Python packages should also have short, all-lowercase names, although the use of underscores is discouraged.\n",
97+
"Function names should be lowercase, with words separated by underscores as necessary to improve readability. Exp: def withdrawal(): or def bank_withdrawal():\n",
98+
"\n",
99+
"5. Variable names follow the same convention as function names.\n",
100+
"```\n",
101+
"a=[1,2,3]\n",
102+
"d={‘a’:1}\n",
103+
"colors=[‘red’,’blue’]\n",
104+
"```\n",
105+
"6. Method names and also instance variables should be lowercase with words separated by underscores as necessary to improve readability.\n",
106+
"7. Use one leading underscore only for non-public methods and instance variables.\n",
107+
"\n",
91108
"\n",
92109
"## Constants\n",
93110
"A `constant` is a special type of variable whose value cannot (is not) be changed. Exp: PI = 3.14\n",

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /