When to use weak references in Python?

Posted by bodacydo on Stack Overflow See other posts from Stack Overflow or by bodacydo
Published on 2010-03-12T22:25:20Z Indexed on 2010/03/12 22:27 UTC
Read the original article Hit count: 533

Filed under:
|

Can anyone explain usage of weak references?

The documentation doesn't explain it precisely, it just says that the GC can destroy the object linked to via a weak reference at any time. Then what's the point of having an object that can disappear at any time? What if I need to use it right after it disappeared?

Can you please explain them with some good examples?

Thanks, Boda Cydo.

© Stack Overflow or respective owner

Related posts about weak-references

Related posts about python