+1 to treating the 1/x as a special case in the coercion model.

It would also help with situations like 

{{{
sage: F.<x,y>=FreeGroup()
sage: 1/x
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-2-fd72f6c47fe6> in <module>()
----> 1 Integer(1)/x

/home/mmarco/sage/src/sage/structure/element.pyx in 
sage.structure.element.RingElement.__div__ 
(/home/mmarco/sage/src/build/cythonized/sage/structure/element.c:17294)()
   1950         if have_same_parent_c(self, right):
   1951             return (<RingElement>self)._div_(<RingElement>right)
-> 1952         return coercion_model.bin_op(self, right, div)
   1953 
   1954     cpdef RingElement _div_(self, RingElement right):

/home/mmarco/sage/src/sage/structure/coerce.pyx in 
sage.structure.coerce.CoercionModel_cache_maps.bin_op 
(/home/mmarco/sage/src/build/cythonized/sage/structure/coerce.c:9915)()
   1077         # We should really include the underlying error.
   1078         # This causes so much headache.
-> 1079         raise TypeError(arith_error_message(x,y,op))
   1080 
   1081     cpdef canonical_coercion(self, x, y):

TypeError: unsupported operand parent(s) for '/': 'Integer Ring' and 'Free 
Group on generators {x, y}'

}}}

You might argue that `1` cannot be coerced into `F`, which is technically 
true, but...

{{{
sage: F.one()
1
}}}

So in some sense one can say that `1`is in `F`

-- 
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 https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to