Ticket #13530: 13530-spline-list-copy.patch

File 13530-spline-list-copy.patch, 1.2 KB (added by jvkersch, 10 years ago)
  • sage/gsl/interpolation.pyx

    # HG changeset patch
    # User Joris Vankerschaver <joris.vankerschaver@gmail.com>
    # Date 1348842516 -3600
    # Node ID 5c8769bc600f209e56117c965843514960d51af2
    # Parent  59a76a59c8e7c4b25cc26a30d8922b580be077bf
    trac 13530: spline list method exposes interpolation points
    
    diff --git a/sage/gsl/interpolation.pyx b/sage/gsl/interpolation.pyx
    a b  
    201201
    202202    def list(self):
    203203        """
    204         Underlying list of points that this spline goes through.  This
    205         is a reference to the list, not a copy.
     204        Underlying list of points that this spline goes through. 
    206205       
    207206        EXAMPLES::
    208207
    209208            sage: S = spline([(1,1), (2,3), (4,5)]); S.list()
    210209            [(1, 1), (2, 3), (4, 5)]
     210
     211        This is a copy of the list, not a reference (:trac:`13530`)::
     212
     213            sage: S = spline([(1,1), (2,3), (4,5)])
     214            sage: L = S.list(); L
     215            [(1, 1), (2, 3), (4, 5)]
     216            sage: L[2] = (3, 2)
     217            sage: L
     218            [(1, 1), (2, 3), (3, 2)]
     219            sage: S.list()
     220            [(1, 1), (2, 3), (4, 5)]
     221
    211222        """
    212         return self.v
     223        return self.v[:]
    213224
    214225    def __len__(self):
    215226        """