質問編集履歴
3
typo
title
CHANGED
File without changes
|
body
CHANGED
@@ -19,7 +19,7 @@
|
|
19
19
|
class Foo:
|
20
20
|
def __init__(self, bar: BarBase):
|
21
21
|
self.bar = bar
|
22
|
-
def
|
22
|
+
def method(self):
|
23
23
|
return self.bar()
|
24
24
|
```
|
25
25
|
とするべきか
|
2
typo
title
CHANGED
File without changes
|
body
CHANGED
@@ -27,7 +27,7 @@
|
|
27
27
|
class Foo:
|
28
28
|
def __init__(self, Bar: BarBase):
|
29
29
|
self.Bar = Bar
|
30
|
-
def
|
30
|
+
def method(self):
|
31
31
|
return self.Bar()
|
32
32
|
```
|
33
33
|
とするべきかで悩んでいます.
|
1
具体例追記
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
|
1
|
+
Pythonでクラスを変数に代入する場合の命名規則について
|
body
CHANGED
@@ -1,1 +1,33 @@
|
|
1
|
-
Pythonの命名規則について,PEP8では変数は小文字スネークケース,クラスはパスカルケースとされていますが,変数にインスタンスではなくクラスを代入したい場合はどちらを使用するのがよいのでしょうか.
|
1
|
+
Pythonの命名規則について,PEP8では変数は小文字スネークケース,クラスはパスカルケースとされていますが,変数にインスタンスではなくクラスを代入したい場合はどちらを使用するのがよいのでしょうか.
|
2
|
+
|
3
|
+
|
4
|
+
具体的には
|
5
|
+
```py
|
6
|
+
class BarBase(metaclass=ABCMeta):
|
7
|
+
pass
|
8
|
+
|
9
|
+
class Bar1(BarBase):
|
10
|
+
pass
|
11
|
+
|
12
|
+
class Bar2(BarBase):
|
13
|
+
pass
|
14
|
+
```
|
15
|
+
|
16
|
+
に対して,
|
17
|
+
|
18
|
+
```py
|
19
|
+
class Foo:
|
20
|
+
def __init__(self, bar: BarBase):
|
21
|
+
self.bar = bar
|
22
|
+
def mathod(self):
|
23
|
+
return self.bar()
|
24
|
+
```
|
25
|
+
とするべきか
|
26
|
+
```py
|
27
|
+
class Foo:
|
28
|
+
def __init__(self, Bar: BarBase):
|
29
|
+
self.Bar = Bar
|
30
|
+
def mathod(self):
|
31
|
+
return self.Bar()
|
32
|
+
```
|
33
|
+
とするべきかで悩んでいます.
|