■ getweakrefcount 함수를 사용해 약한 참조 카운트를 구하는 방법을 보여준다.
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
import weakref class Apple: pass apple1 = Apple() apple1.Color = "빨강" weakref1 = weakref.ref(apple1) weakProxy1 = weakref.proxy(apple1) print(weakref.getweakrefcount(apple1)) # 2 |