On Mar 13, 2011, at 13:09 , daveloeffler wrote:

> On Mar 13, 6:34 pm, "Justin C. Walker" <[email protected]> wrote:
>> Perhaps I should have expected this, but
>> 
>> sage: R=Integers(5)
>> sage: L=R.list()
>> sage: L
>>  [0, 1, 2, 3, 4]
>> ## I just want the *non-zero* elements:
>> sage: L.__delitem__(0)
>> sage: L
>>  [1, 2, 3, 4]
>> ## Ah!
>> ## Uh-oh
>> sage: R.list()
>>  [1, 2, 3, 4]
>> ## Better fix that...
>> sage: R=Integers(5)
>> ## Oops!  I've broken Z/5*Z!!
>> sage: R.list()
>>  [1, 2, 3, 4]
> 
>> 
>> I hope Sage isn't a distributed system, where the cache is shared across all 
>> users...
>> 
>> Is this a "Doctor: Then don't do that" moment, or should "obj.list()" return 
>> a deep copy?
> 
> Oh dear! The method "obj.list()" should *definitely* be returning a
> deep copy.
> 
> Note that this is simultaneously revealing 2 bugs. The "broken" Z/5Z
> should go away when you re-create R, but it doesn't because there's a
> reference to it stored by the coercion model -- see #715.

The first is
    <http://trac.sagemath.org/sage_trac/ticket/10927>

As for the second, I'm not sure.  The cache issue is a side-effect of the bug, 
no?

Once the bug is fixed (and you restart sage :-}), the second one shouldn't be a 
problem.

> 
>> ## But, ironically,
>> sage: R(0) in R
>> True
> 
> (This is what you'd expect: containment checks don't construct a list
> first, since if they did, "3 in Integers(2^50)" would take rather a
> while...)

I'm guilty of over-ironizing (that was meant as a wise-crack (as of course is 
this (...))).

Thanks!

Justin

--
Justin C. Walker, Curmudgeon at Large
Institute for the Absorption of Federal Funds
-----------
My wife 'n kids 'n dogs are gone,
I can't get Jesus on the phone,
But Ol' Milwaukee's Best is my best friend.
-----------


-- 
To post to this group, send an email to [email protected]
To unsubscribe from this group, send an email to 
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to