Hi Jason, >> Looking into sage library, I found the following code: file matrix0.pyx >> >> cdef class Matrix(sage.structure.element.Matrix): >> ... >> def __copy__(self): >> """ >> ... >> """ >> return self.__copy__() >> >> what is the intention here ? I hope this code is never executed ? Why not >> return an error ? >> > > Generic matrices have their own __copy__ method (overriding this). I hope > the above code isn't ever executed either. > > Here is the result of executing the method, which gives the expected error: > > sage: import sage.matrix.matrix0 > sage: A = sage.matrix.matrix0.Matrix(MatrixSpace(QQ,2)) > sage: type(A) > <type 'sage.matrix.matrix0.Matrix'> > sage: copy(A) > --------------------------------------------------------------------------- > RuntimeError Traceback (most recent call last) > > /Users/grout/sage-4.4.2-test3/spkg/standard/sagenb-0.8.p3/src/sagenb/<ipython > console> in <module>() > > /Users/grout/sage/local/lib/python/copy.pyc in copy(x) > 77 copier = getattr(cls, "__copy__", None) > 78 if copier: > ---> 79 return copier(x) > 80 > 81 reductor = dispatch_table.get(cls) > > /Users/grout/sage/local/lib/python2.6/site-packages/sage/matrix/matrix0.so > in sage.matrix.matrix0.Matrix.__copy__ (sage/matrix/matrix0.c:2718)() > > [snip] > > RuntimeError: maximum recursion depth exceeded while calling a Python object > sage: > > So the doctests for that function are useless for testing that function, > obviously.
So this is just a strange way to raise an error ;-) No particular strange Cython stuff to allows for inheritance or whatever... Cheers, Florent -- To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URL: http://www.sagemath.org