객체는 자신을 참조하는 수가 0이 되면 garbage collection의 대상이 된다.
a = 42 # Create object <42>
b = a # Increase ref. count of <42>
c = [a] # Increase ref. count of <42>
del a # Decrease ref. count of <42>
b = 100 # Decrease ref. count of <42>
c[0] = -1 # Decrease ref. count of <42>
'길 > Python' 카테고리의 다른 글
Class Methods / Static Methods / Properties (0) | 2021.02.13 |
---|---|
Data Hiding (0) | 2021.02.12 |
클래스 / 객체 / 인스턴스 구분 (0) | 2021.02.12 |
magic methods (0) | 2021.02.12 |
subclass에서 super()는 superclass의 method를 읽는다. (0) | 2021.02.12 |