Pablo Galindo Salgado <pablog...@gmail.com> added the comment:
> I disagree that a child should keep its parent alive. But this is normal across the standard library. For example, here is how a deque iterator keeps the deque alive: >>> x = deque([1,2,3]) >>> deque_iter = iter(x) >>> deque_weakref = weakref.ref(x) >>> del x >>> gc.collect() >>> gc.get_referrers(deque_weakref()) [<_collections._deque_iterator object at 0x0000024447ED6EA8>] Here, the deque iterator is the *only* reference to the deque. When we destroy it, the deque is destroyed: >>> del deque_iter >>> gc.collect() >>> deque_weakref() None ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34172> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com