Python naming convention (from PEP8)

Python has "PEP8: Python Code Style Guide", which also describes naming conventions such as variable names and function names. By matching the naming convention and coding style, you can reduce the burden on those who read the source code and those who review it. Please refer not only to the naming convention but also to the naming method described in "[Readable Code](https://qiita.com/search?q=tag%3A Readable Code)".

PEP8

Use Naming convention
Private, private Add one underscore at the beginning
Avoid name collisions in subclasses Add two underscores at the beginning
Special properties, special methods Add two underscores before and after
(Because it is prepared in the language specification, do not define it yourself)
Avoid conflicts with reserved words and built-in function names Add one underscore at the end
Use Naming convention
package Short names in all lowercase, no underscores
module Short names, all lowercase, may be separated by underscores
Class, exception CapWords method (connect uppercase words only at the beginning, do not use underscores)
Functions, methods Only lowercase letters, separate words with underscores as needed
constant Uppercase only, words separated by underscore
variable Only lowercase letters, separate words with underscores as needed
1 character variable l (Lowercase el)、O (Uppercase O)、I(Uppercase eye)Never use
(Numbers depending on the font10Because it is indistinguishable)

Other than PEP8

Use Naming convention
Discard variable 1 underscore
(When variables are required for for loops and split assignments but not used)

Readable code

Such.

Recommended Posts

Python naming convention (from PEP8)
Sorting files by Python naming convention
sql from python
MeCab from Python
Touch MySQL from Python 3
Operate Filemaker from Python
Access bitcoind from python
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
Python from or import
Use MySQL from Python
Run python from excel
Execute command from Python
Use MySQL from Python
Operate LXC from Python
Manipulate riak from python
Force Python from Fortran
Use BigQuery from python.
Execute command from python
[Python] Read From Stdin
Use mecab-ipadic-neologd from python
Flatten using Python yield from
Call CPLEX from Python (DO cplex)
Post from Python to Slack
Cheating from PHP to Python
Make MeCab available from Python3
Information obtained from tweet_id (Python)
Run illustrator script from python
Use MySQL from Anaconda (python)
How to connect to various DBs from Python (PEP 249) and SQLAlchemy
Anaconda updated from 4.2.0 to 4.3.0 (python3.5 updated to python3.6)
Study from Python Hour4: Object-oriented ②
Query Athena from Lambda Python
Study from Python Hour3: Functions
Start / stop GCE from python
Switch from python2.7 to python3.6 (centos7)
Connect to sqlite from python
Install pyenv from Homebrew, install Python from pyenv
Study from Python Hour4: Object-oriented ①
With skype, notify with skype from python!
Use e-Stat API from Python
Register redmine issue from Python
Call Matlab from Python to optimize
Execute Python script from batch file
Call a Python function from p5.js.
Python: Exclude tags from html data
Use Stanford Core NLP from Python
Try IAM Database Authentication from Python
Call C from Python with DragonFFI
Hit treasure data from Python Pandas
Get data from Quandl in Python
Python, yield, return, and sometimes yield from
Install Python from source with Ansible
Notes on using MeCab from Python
Post from python to facebook timeline
python> link> from __future__ import absolute_import
Operate an I2C-connected display from Python
[Lambda] [Python] Post to Twitter from Lambda!
Operate DynamoDB from Python like SQL.
Call popcount from Ruby / Python / C #
Existence from the viewpoint of Python