On 2-Dec-07, at 7:37 PM, Iftikhar Burhanuddin wrote:
> > On Sun, 2 Dec 2007, William Stein wrote: >> On Dec 2, 2007 5:42 PM, Iftikhar Burhanuddin <[EMAIL PROTECTED]> >> wrote: >>> >>> Hi folks, >>> >>> Under the current coercion model would a coercion exception (of type >>> 'exceptions.TypeError') be raised, given that a python int and >>> not a ZZ >>> integer is being coerced to an element of M_2(GF(7)), instead of the >>> computation going through? >>> >> >> I'm not sure what you're asking, but to clarify the bug that Craig >> reported >> I think had absolutely nothing whatever to do with the coercion >> model. The problem was that the constructor for matrices mod n >> did correctly coerce elements to unsigned ints (in the range 0..n-1) >> in case of constructing a scalar matrix. > > Dear William, > > My question wasn't about the bug. Craig's bug report gave rise to a > question about SAGE's coercion model, which can be paraphrased as > follows: > > Shouldn't > > sage: GF(5)(int(4)) > 4 > > raise a 'TypeError' exception, given that a Python int (and not a > SAGE/ZZ > integer) is being coerced to an element of SAGE's finite field? > > To answer my own question, I guess the answer is no, because SAGE > aims at > achieving interoperability between systems. I think the answer is no, but not for interoperability. You example is using __call__; that should try hard to make sense of the input in a perhaps non-canonical way. If you modify the example to sage: GF(5)(1) * int(2) 2 Then the coercion system should kick in, and perhaps the answer should be TypeError. Nick --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://sage.scipy.org/sage/ and http://modular.math.washington.edu/sage/ -~----------~----~----~----~------~----~------~--~---