On Jul 1, 2009, at 1:22 AM, Kwankyu wrote: > Hi, > > I am trying to understand the coercion model... > > In the followiing, C is a parent that I defined, in which (I think) I > implemented a coercion map from P to C, but not from ZZ to C. > > sage: P > Multivariate Polynomial Ring in x, y over Finite Field in a of size > 2^4 > sage: C.has_coerce_map_from(P) > True > sage: P.has_coerce_map_from(ZZ) > True > sage: C.has_coerce_map_from(ZZ) > False > > I expected the coercion model automatically finds the coercion map > from ZZ to C for me. Isn't this the way that the coercion model works?
It does some deduction, but given C and ZZ alone, it would have trouble guessing that P is the "connecting" ring. (If P is the base_ring of C, or was passed in via _populate_coercion_lists_ then it can deduce this.) - Robert --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---