Michael Foord <mich...@voidspace.org.uk> added the comment:

Nick - in general proxy objects have a *reference* to their target (weakref 
being somewhat of a special case), and pickle can already handle multiple 
references to the same target when deserializing an object graph. So I don't 
see that argument holding water for the general case.

I also challenge the assertion that for a weakref proxy "you never want to 
serialise the proxy, you want to serialise the original object". Why? If the 
weakref proxy could be serialized and deserialized including the target, why 
would you *not* want a weakref proxy back (on its own there isn't much use for 
that but as part of an object graph having serialization turn a weakref into a 
strong reference sounds like an anti-feature).

However, it looks like implementing __reduce__ is sufficient for my use case. 
Although the special-method-lookup-on-instance is still a nuisance.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue14577>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to