Am Sonntag, 21. Juni 2015 03:56:43 UTC+2 schrieb Nils Bruin: > > On Saturday, June 20, 2015 at 3:34:06 PM UTC-7, Martin R wrote: >> >> >> What is the bug here? Do you think matrix(2,3,1) should succeed? Do you >> think it should produce a different error message? >> >> No, I think that matrix(nrows, ncols, element) sould fail, unless element >> is callable or iterable. >> > > We'd need to do serious *extra* work and checking for that. Currently, if > MatrixSpace(R,n,m)(L) works then matrix(R,n,m,L) will work too. Making sure > that matrix(R,n,m,L) breaks for some L where MatrixSpace succeeds would > require extra testing and explicit error raising. >
That was my initial question in this thread: I do not understand where (or why) MatrixSpace calls _matrix_constructor. I set a breakpoint in _matrix_constructor and did M=MatrixSpace(SR, 2,2) and then trace("M(x)"). The breakpoint was never reached. > Would that really be an improvement? To ensure that the following happens? > > sage: matrix(2,2,x+y) > [0 1] > [1 2] > > (assuming x+y would be recognized as callable before it is recognized as > iterable)? I think the current answer is less surprising. > Yes, in my opinion certainly. Martin -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.