[pypy-dev] thunk object space : become() quirks

Boris Borcic bborcic at gmail.com
Wed Nov 14 15:25:35 CET 2007


Hello,

Looking for a way to use pypy in any manner, I came up with an idea for a
deterministic sudoku solver that would use the 'become()' feature of the thunk
object space. However, this doesn't work as I expected. The following shell
trace illustrates my problem. Is this a bug or otherwise ? Can anybody explain ?

BTW, I am using the pypy 1.0.0 build 41438 windows binary distribution.

[subquestion : is pypy-dev appropriate for such a question ?]

TIA, Boris Borcic


>>>> s = lambda *x : set(x)
>>>> s1 = s(1)
>>>> s2 = s(2)
>>>> s3 = s(3)
>>>> s4 = s(4)
>>>> s1,s2,s3,s4
(set([1]), set([2]), set([3]), set([4]))
>>>> s1.update(s2)
>>>> become(s2,s1)
>>>> s3.update(s4)
>>>> become(s4,s3)
>>>> s1,s2,s3,s4
(set([1, 2]), set([1, 2]), set([3, 4]), set([3, 4]))


>>>> s4.update(s2)
>>>> s4
set([3, 4])
------------------> expected set([1,2,3,4])
>>>> s2
set([1, 2])
>>>> s4 is s3
True
>>>> s3.update(s2)
>>>> s4
set([3, 4, 2])
------------------> expected set([1,2,3,4])
>>>> s3
set([3, 4, 2])
>>>> s1
set([1, 2])
>>>> s1 is s2
True
>>>> s3.update(s1)
>>>> s4
set([3, 4, 2, 1])
>>>>



More information about the Pypy-dev mailing list