Hello,

I'm not sure if I should open a ticket on the following issue, or if
this is just a case of "Error Between Keyboard And Chair". Here is a
simplified version of what happened.

I had parents A and B and map phi between them, as follows:

sage: A = CombinatorialFreeModule(ZZ,[1,2,3],prefix='X'); X = A.basis()
sage: B = CombinatorialFreeModule(ZZ,[4,5,6],prefix='Y'); Y = B.basis()
sage: phi = A.module_morphism(lambda i: Y[i+3],codomain=B)
sage: phi(X[1] + X[2]) # example
Y[1] + Y[2]

I wonder if there is already a coercion from A and B:

sage: B.has_coerce_map_from(A)
False

There isn't, so I decide to add one.

sage: phi.register_as_coercion()
AssertionError: coercion from Free module generated by {1, 2, 3} over
Integer Ring to Free module generated by {4, 5, 6} over Integer Ring
already registered or discovered

But that seems not to be true:

sage: B.has_coerce_map_from(A)
False

***

It seems that the first call to 'has_coerce_map_from' touches the
coercion cache, and as a result it is no longer possible to register a
coercion between the associated objects. But it took me some time to
work out what was actually going on; I did not expect asking the
question to forbid me from providing an answer! So my first thought was
that this is a bug. On the other hand, I don't know much about the
coercion system or why this behavior exists, so if it really is intended
to work this way, I won't open a ticket. (Or maybe just a documentation
ticket).

Thanks for any explanation,
Jason

-- 
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

Reply via email to