Hi

It's a good idea but it won't work (in fact the _element_constructor_ does accept zero correctly in my case). The coercion framework _first_
tries to find a common parent and _then_ the rest happens.

Best
    Jonas

On 21.02.2015 22:59, Eric Gourgoulhon wrote:
Hi,

Le samedi 21 février 2015 21:59:05 UTC+1, Jonas Jermann a écrit :


    The parent is a vector space / module not a ring. Every vector space
    contains zero, so in my opinion from a conceptual point of view
    adding zero should not change the parent space.

    However since it views 0 as an integer and not as (an element) the zero
    subspace (unless we forcefully map it there) it seems hard to change
    this behavior. :-(


It seems that a possible way to have 0 + MyElement work even if ZZ does
not coerce to MyElement.parent() is to have
MyElement.parent()._element_constructor_ accept 0 (i.e. Integer(0)) as
an argument and return the zero element of your vector space / module
for such an argument.  Am I correct?

Eric.

--
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
<mailto:sage-devel+unsubscr...@googlegroups.com>.
To post to this group, send email to sage-devel@googlegroups.com
<mailto:sage-devel@googlegroups.com>.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

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

Reply via email to