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. > ## 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...) -- 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
