回答編集履歴
1
追記
test
CHANGED
@@ -35,3 +35,39 @@
|
|
35
35
|
print(C.B.b2)
|
36
36
|
|
37
37
|
```
|
38
|
+
|
39
|
+
|
40
|
+
|
41
|
+
追記:Enumはすごい特殊なんで以下の様にしないと一部ちゃんと機能しませんね。
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
```python
|
46
|
+
|
47
|
+
from collections import namedtuple
|
48
|
+
|
49
|
+
from enum import Enum
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
class C:
|
54
|
+
|
55
|
+
class A(namedtuple('A', 'a1 a2')):
|
56
|
+
|
57
|
+
pass
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
B = Enum('B', dict(b1=A(a1=3, a2=4),
|
62
|
+
|
63
|
+
b2=A(a1=4, a2=5)))
|
64
|
+
|
65
|
+
|
66
|
+
|
67
|
+
print(repr(C.B.b1))
|
68
|
+
|
69
|
+
print(repr(C.B.b2))
|
70
|
+
|
71
|
+
print(C.B)
|
72
|
+
|
73
|
+
```
|