On Wednesday, January 4, 2017 at 7:54:57 AM UTC-6, Marc Mezzarobba wrote:
>
> Daniel Krenn wrote: 
> > In the doc of sage.rings.qqbar.AlgebraicRealField._coerce_map_from_ 
> > there is the following test: 
> > 
> >     sage: K.<a> = QuadraticField(7, embedding=AA(7).sqrt()) 
> >     sage: AA.has_coerce_map_from(K) 
> >     True 
> > 
> > Why does this return (correctly) True, although the code of this 
> > method is simply 
> > 
> >     def _coerce_map_from_(self, from_par): 
> >         return (from_par is ZZ or from_par is QQ 
> >                 or from_par is AA) 
> > 
> > ? 
>
> Probably because NumberField_generic.__init__() does: 
>
>         self._populate_coercion_lists_(embedding=embedding) 
>

That is not true. Note that Foo.has_coerce_map_from() is not 
Foo._coerce_map_from_(). The method has_coerce_map_from() calls 
_coerce_map_from_, which should either return a coercion map or True, and 
in the latter case, then it uses Foo(bar) to define the coercion (which 
really uses _element_constructor_). What has_coerce_map_from() does is it 
checks to see if _coerce_map_from_() returns something that is not False 
(or perhaps None, I forget off-hand).

Best.
Travis

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