(<cell at 0x107a44f78: list object at 0x107a91a48>,)
>>> avg.__closure__[0].cell_contents
[10, 11, 12]
지금까지 설명한 내용을 정리해 보자. 클로저는 함수가 정의될 때 존재하던 자유 변수에 대한
바인딩을 유지하는 함수이다. 따라서 함수를 정의하는 범위가 사라진 후 함수를 호출해도 자유
변수에 접근할 수 있다.
함수가 비전역 외부 변수를 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.