回答編集履歴
1
追記
test
CHANGED
@@ -59,3 +59,41 @@
|
|
59
59
|
3
|
60
60
|
|
61
61
|
```
|
62
|
+
|
63
|
+
|
64
|
+
|
65
|
+
---
|
66
|
+
|
67
|
+
工夫次第で評価を遅延させることもできますが、処理を追いづらくなるのでお勧めしません。
|
68
|
+
|
69
|
+
```Python
|
70
|
+
|
71
|
+
a = 1
|
72
|
+
|
73
|
+
b = 2
|
74
|
+
|
75
|
+
|
76
|
+
|
77
|
+
f = lambda: a + b
|
78
|
+
|
79
|
+
print(f())
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
b = 3
|
84
|
+
|
85
|
+
print(f())
|
86
|
+
|
87
|
+
```
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
**実行結果** [Wandbox](https://wandbox.org/permlink/6voqRiBdVMgyigFb)
|
92
|
+
|
93
|
+
```
|
94
|
+
|
95
|
+
3
|
96
|
+
|
97
|
+
4
|
98
|
+
|
99
|
+
```
|