Hi Florent, Robert, On Mon, Oct 26, 2009 at 06:56:39PM +0100, Florent hivert wrote: > I'm having trouble with coercion in sage 4.2... > The following (reduced) example works with sage 4.1.2 and breaks with sage > 4.2. Here is the error: > > File "<doctest __main__.example_0[2]>", line 1, in <module> > bla = Essai(); bla###line 11: > sage: bla = Essai(); bla > File "/home/averell/.sage/tmp/wrapp.py", line 16, in __init__ > mor.register_as_coercion() > File "morphism.pyx", line 116, in > sage.categories.morphism.Morphism.register_as_coercion > (sage/categories/morphism.c:2371) > File "parent.pyx", line 1018, in > sage.structure.parent.Parent.register_coercion (sage/structure/parent.c:8301) > File "parent.pyx", line 1043, in > sage.structure.parent.Parent.register_coercion (sage/structure/parent.c:8090) > AssertionError: coercions must all be registered up before use > > Any help or suggestion ?
A quick note: #5598 (allow post-creation (pre-use) declaration of coercions) went in Sage in 4.2. Before that, we were using in Sage-Combinat a pure Python version without sanity checks. I haven't thought out your example. But we have similar issues in a couple of our categories/examples. Now the question is: are the checks in register_as_coercion too rigid for practical use cases? Or should we be somehow more lazy in those use cases? Cheers, Nicolas > from sage.structure.parent import Parent > from sage.rings.integer_ring import IntegerRing > from sage.categories.homset import Hom > class Essai(Parent): > """ > TESTS:: > > sage: bla = Essai(); bla > <class 'wrapp.Essai'> > """ > def __init__(self): > Parent.__init__(self) > mor = Hom(self, IntegerRing())(lambda z: 1) > mor.register_as_coercion() > > Nicolas -- Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net> http://Nicolas.Thiery.name/ --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sage-combinat-devel" group. To post to this group, send email to sage-combinat-devel@googlegroups.com To unsubscribe from this group, send email to sage-combinat-devel+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-combinat-devel?hl=en -~----------~----~----~----~------~----~------~--~---