◎クロージャー
def b(a, b): #aとbを引数に指定
def inner():
return a + b
return inner #innerを返さずに処理
p = b(100, 50) #pにbの関数を代入
k = p() #さらにそれをkに代入
print(k) #最後にkを出力(innerがここで返されて処理される)
More than 5 years have passed since last update.
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme