#19813: VectorSpace basis() is mutable
----------------------------------+------------------------
       Reporter:  mjo             |        Owner:
           Type:  defect          |       Status:  new
       Priority:  major           |    Milestone:  sage-7.0
      Component:  linear algebra  |   Resolution:
       Keywords:                  |    Merged in:
        Authors:                  |    Reviewers:
Report Upstream:  N/A             |  Work issues:
         Branch:                  |       Commit:
   Dependencies:                  |     Stopgaps:
----------------------------------+------------------------

Comment (by nbruin):

 No, this is indeed quite a bad bug, since VectorSpaces are
 UniqueRepresentation:
 {{{
 sage: V=VectorSpace(QQ,3)
 sage: W=VectorSpace(QQ,3)
 sage: b=V.basis()
 sage: b+="a"
 sage: len(W.basis())
 4
 }}}
 Note that V and W are (to the user) obtained independently, so a change on
 one should not affect the other.

 Also note that some effort is undertaken to make the thing immutable:
 {{{
 sage: b.append("a")
 ValueError: object is immutable; please change a copy instead.
 sage: type(b)
 <class 'sage.structure.sequence.Sequence_generic'>
 sage: b.is_mutable()
 False
 sage: type(b).__iadd__
 <slot wrapper '__iadd__' of 'list' objects>
 }}}
 So it seems we just failed to shadow the "__iadd__" method.

--
Ticket URL: <http://trac.sagemath.org/ticket/19813#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to