On Sun, 12 Sep 2010 06:12:42 +0200 (CEST) raymond.hettinger <python-checkins at 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.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4