On 05/07/2012 19:47, Dieter Maurer wrote:
Frank Millmanfr...@chagford.com writes:
I would still like to know why weakref.proxy raised an exception. I
have re-read the manual several times, and googled for similar
problems, but am none the wiser.
In fact, it is documented. Accessing a proxy
On Fri, Jul 6, 2012 at 1:00 AM, Frank Millman fr...@chagford.com wrote:
I have investigated a bit further, and now I have a clue as to what is
happening, though not a full understanding.
If you use 'b = weakref.ref(obj)', 'b' refers to the weak reference, and
'b()' refers to the referenced
On Fri, Jul 6, 2012 at 11:04 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On that, I'm really not sure. I tried to reproduce the problem
locally and wasn't able to. What build of Python are you using, and
on what platform?
I spoke too soon, I am able to reproduce it. I think what's going on
On Fri, Jul 6, 2012 at 11:48 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
def del_b(self, b):
for i, x in enumerate(self.array):
if b is x:
del self.array[i]
That should probably have an explicit break on the end:
def del_b(self, b):
for i, x
Ian Kelly wrote:
def del_b(self, b):
for i, x in enumerate(self.array):
if b is x:
del self.array[i]
break
Nice work, Ian.
--
http://mail.python.org/mailman/listinfo/python-list
On 06/07/2012 20:12, Ethan Furman wrote:
Ian Kelly wrote:
def del_b(self, b):
for i, x in enumerate(self.array):
if b is x:
del self.array[i]
break
Nice work, Ian.
I second that. Thanks very much, Ian.
Frank
--
http://mail.python.org/mailman/listinfo/python-list
Frank Millman fr...@chagford.com writes:
I have a situation where I thought using weakrefs would save me a bit
of effort.
Instead of the low level weakref, you might use a WeakKeyDictionary.
--
http://mail.python.org/mailman/listinfo/python-list
On 05/07/2012 10:46, Dieter Maurer wrote:
Frank Millmanfr...@chagford.com writes:
I have a situation where I thought using weakrefs would save me a bit
of effort.
Instead of the low level weakref, you might use a WeakKeyDictionary.
Thanks, Dieter. I could do that.
In fact, a WeakSet
Frank Millman fr...@chagford.com writes:
On 05/07/2012 10:46, Dieter Maurer wrote:
Instead of the low level weakref, you might use a WeakKeyDictionary.
Thanks, Dieter. I could do that.
In fact, a WeakSet suits my purposes better. I tested it with my
original example, and it works
Hi all
I have a situation where I thought using weakrefs would save me a bit of
effort.
I have a basic publish/subscribe scenario. The publisher maintains a
list of listener objects, and has a method whereby a listener can
subscribe to the list by passing in 'self', whereupon it gets added
10 matches
Mail list logo