質問
いを弱参照オブジェクトへのPython?
解決
>>> import weakref
>>> class Object:
... pass
...
>>> o = Object()
>>> r = weakref.ref(o)
>>> # if the reference is still active, r() will be o, otherwise None
>>> do_something_with_o(r())
を参照 wearkrefモジュールdocs できます。も利用できます weakref.proxy
作成するオブジェクトプロキシ。をスローします ReferenceError
使用する場合のリファレントがなされます。
所属していません StackOverflow