On Sun, 12 Sep 2010 06:12:42 +0200 (CEST) raymond.hettinger <python-check...@python.org> wrote: > > - # Each link is stored as a list of length three: [PREV, NEXT, KEY]. > + # The back links are weakref proxies (to prevent circular references).
Are you sure this prevents anything? Since your list is circular, forward links are enough to build a reference cycle. Actually, this is exemplified here: > + self.__root = root = _Link() # sentinel node for the doubly > linked list > + root.prev = root.next = root `root.next = root` is enough to create a cycle, even if you make root.prev a weakref. What you need is to make both prev and next weakrefs. All list nodes all held by the __map dict anyway. If you are bothered about speed, an alternative would be a classic finalization scheme, using a class-wide set of OrderedDict weakrefs that remove themselves and clean up the doubly-linked list when the OrderedDict becomes dead. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com