Author georg.brandl
Recipients georg.brandl, gvanrossum, twouters
Date 2007-08-30.19:02:39
SpamBayes Score 0.116548
Marked as misclassified No
Message-id <46D71456.9040905@gmx.net>
In-reply-to <ca471dc20708300936v35ece76dr95304856bfd57a9f@mail.gmail.com>
Content
Guido van Rossum schrieb:
> Guido van Rossum added the comment:
> 
> On 8/30/07, Thomas Wouters <report@bugs.python.org> wrote:
>>
>> Thomas Wouters added the comment:
>>
>> Here's a working version of that idea, with a WeakSet implementation I
>> had lying around (but never really used.) It seems to work, and fixes
>> the refcount issues, but the WeakSet could do with some extra tests ;-)
> 
> I was torturing the WeakSet implementation, but didn't get very far:
> 
> Python 3.0x (py3k, Aug 30 2007, 09:27:35)
> [GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from weakref import WeakSet as WS
> [40407 refs]
>>>> a = WS([1, 2, 3])
> Fatal Python error: Cannot recover from stack overflow.
> Aborted

The update() method can not be implemented in terms of converting the
argument to a WeakSet, since that leads to infinite recursion on creation
(as to why you get this fatal error, not a RuntimeError, no idea).

Also, the fact that the operator-versions of set operations only support
other sets as their second operands, while the method-versions support any
iterable, is not preserved.

Georg
History
Date User Action Args
2007-08-30 19:02:39georg.brandlsetspambayes_score: 0.116548 -> 0.116548
recipients: + georg.brandl, gvanrossum, twouters
2007-08-30 19:02:39georg.brandllinkissue1061 messages
2007-08-30 19:02:39georg.brandlcreate