回答編集履歴
5
追記
test
CHANGED
@@ -84,6 +84,18 @@
|
|
84
84
|
|
85
85
|
```plain
|
86
86
|
|
87
|
+
>python --version
|
88
|
+
|
89
|
+
Python 3.6.2 :: Continuum Analytics, Inc.
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
>python -m pycodestyle --version
|
94
|
+
|
95
|
+
2.4.0
|
96
|
+
|
97
|
+
|
98
|
+
|
87
99
|
>type tera3.py
|
88
100
|
|
89
101
|
print(1,2)
|
4
再送
test
CHANGED
@@ -117,3 +117,7 @@
|
|
117
117
|
E231: [{'a':'b'}]
|
118
118
|
|
119
119
|
```
|
120
|
+
|
121
|
+
|
122
|
+
|
123
|
+
私の見ている情報が古いのだろうか?
|
3
追記
test
CHANGED
@@ -84,6 +84,36 @@
|
|
84
84
|
|
85
85
|
```plain
|
86
86
|
|
87
|
+
>type tera3.py
|
88
|
+
|
89
|
+
print(1,2)
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
>python -m pycodestyle tera3.py --show-pep8
|
94
|
+
|
87
|
-
E231 missing whitespace after ','
|
95
|
+
tera3.py:1:8: E231 missing whitespace after ','
|
96
|
+
|
97
|
+
Each comma, semicolon or colon should be followed by whitespace.
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
Okay: [a, b]
|
102
|
+
|
103
|
+
Okay: (3,)
|
104
|
+
|
105
|
+
Okay: a[1:4]
|
106
|
+
|
107
|
+
Okay: a[:4]
|
108
|
+
|
109
|
+
Okay: a[1:]
|
110
|
+
|
111
|
+
Okay: a[1:4:2]
|
112
|
+
|
113
|
+
E231: ['a','b']
|
114
|
+
|
115
|
+
E231: foo(bar,baz)
|
116
|
+
|
117
|
+
E231: [{'a':'b'}]
|
88
118
|
|
89
119
|
```
|
2
追記
test
CHANGED
@@ -63,3 +63,27 @@
|
|
63
63
|
TypeError: 'str' object is not callable
|
64
64
|
|
65
65
|
```
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
元の質問に対して
|
70
|
+
|
71
|
+
---
|
72
|
+
|
73
|
+
PythonにはPEP8という規定があり、それに従うのが慣習となっています。
|
74
|
+
|
75
|
+
[PEP 8 -- Style Guide for Python Code](https://www.python.org/dev/peps/pep-0008/)
|
76
|
+
|
77
|
+
[PEP 8 -- Style Guide for Python Code (和訳)](https://pep8-ja.readthedocs.io/ja/latest/#)
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
ただ、『カンマの後には空白を開けましょう』って規定が見当たらないのですよね...
|
82
|
+
|
83
|
+
pycodestyleはしっかりとそれを報告してくれるのですが。
|
84
|
+
|
85
|
+
```plain
|
86
|
+
|
87
|
+
E231 missing whitespace after ','
|
88
|
+
|
89
|
+
```
|
1
追記
test
CHANGED
@@ -28,6 +28,16 @@
|
|
28
28
|
|
29
29
|
|
30
30
|
|
31
|
+
どうしてもorを使いたいなら、次のようにします。
|
32
|
+
|
33
|
+
```Python
|
34
|
+
|
35
|
+
if (str == "Yes") or (str == "yes"):
|
36
|
+
|
37
|
+
```
|
38
|
+
|
39
|
+
|
40
|
+
|
31
41
|
ただし
|
32
42
|
|
33
43
|
---
|