回答編集履歴
1
もう一つ回避策を追記
test
CHANGED
@@ -15,3 +15,23 @@
|
|
15
15
|
y = list(repeat(x, 5))
|
16
16
|
|
17
17
|
```
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
#追記: 逃げない回避策 (注意、役には立ちません)
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
```python
|
26
|
+
|
27
|
+
from inspect import currentframe
|
28
|
+
|
29
|
+
|
30
|
+
|
31
|
+
class class_demo:
|
32
|
+
|
33
|
+
x = 6
|
34
|
+
|
35
|
+
y = [currentframe().f_back.f_locals['x'] for i in range(5)]
|
36
|
+
|
37
|
+
```
|