Re: [Python-Dev] New methods for weakref.Weak*Dictionary types

2006-05-10 Thread Armin Rigo
Hi Tim, On Mon, May 01, 2006 at 04:57:06PM -0400, Tim Peters wrote: # Return a list of weakrefs to all the objects in the collection. # Because a weak dict is used internally, iteration is dicey (the # underlying dict may change size during iteration, due to gc or # activity

Re: [Python-Dev] New methods for weakref.Weak*Dictionary types

2006-05-10 Thread Tim Peters
[Tim Peters] # Return a list of weakrefs to all the objects in the collection. # Because a weak dict is used internally, iteration is dicey (the # underlying dict may change size during iteration, due to gc or # activity from other threads). [Armin Rigo] But then, isn't the

[Python-Dev] New methods for weakref.Weak*Dictionary types

2006-05-01 Thread Fred L. Drake, Jr.
I'd like to commit this for Python 2.5: http://www.python.org/sf/1479988 The WeakKeyDictionary and WeakValueDictionary don't provide any API to get just the weakrefs out, instead of the usual mapping API. This can be desirable when you want to get a list of everything without creating new

Re: [Python-Dev] New methods for weakref.Weak*Dictionary types

2006-05-01 Thread Tim Peters
[Fred L. Drake, Jr.] I'd like to commit this for Python 2.5: http://www.python.org/sf/1479988 The WeakKeyDictionary and WeakValueDictionary don't provide any API to get just the weakrefs out, instead of the usual mapping API. This can be desirable when you want to get a list of everything

Re: [Python-Dev] New methods for weakref.Weak*Dictionary types

2006-05-01 Thread Fred L. Drake, Jr.
On Monday 01 May 2006 16:57, Tim Peters wrote: +1. A real need for this is explained in ZODB's ZODB/util.py's WeakSet class, which contains a WeakValueDictionary: ... As that implementation suggests, though, I'm not sure there's real payback for the extra time taken in the patch's