■ getweakrefs 함수를 사용해 약한 참조 리스트를 구하는 방법을 보여준다.
▶ 예제 코드 (PY)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
import weakref class Apple: pass apple1 = Apple() apple1.Color = "빨강" weakref1 = weakref.ref(apple1) weakProxy1 = weakref.proxy(apple1) print(weakref.getweakrefs(apple1)) """ [<weakref at 0x000001F3CFB52D40; to 'Apple' at 0x000001F3CFBA7520>, <weakproxy at 0x000001F3CFBB4F90 to Apple at 0x000001F3CFBA7520>] """ |