Hi Jonas,

On 2015-02-21, Jonas Jermann <jjerma...@gmail.com> wrote:
> ZZ does not coerce into myElement.parent() so I end up in a much
> larger space than myElement.parent(). However I would prefer if adding
> zero didn't change the parent space.

If ZZ does not coerce into the parent of your element, then the parent
is not a (unitary) ring.

> One reason is for instance that
> sum(...) no longer works properly because it always prepends "0+".

You can avoid it by explicitly providing the starting element to the sum
function.

> Eg: from sage.modular.modform_hecketriangle.all import *
>      myElement = ModularForms().E4()
>      myElement.parent() != sum([myElement]).parent()
>
> Clearly "0" is a special case (the zero subspace does coerce into any of 
> the spaces).
>
> How should I fix this?

By providing a starting point for the summation:
  sage: sum([myElement]).parent()
  ModularFormsRing(n=3) over Integer Ring
  sage: myElement.parent()
  ModularForms(n=3, k=4, ep=1) over Integer Ring
  sage: sum([myElement], myElement.parent().zero()).parent()
  ModularForms(n=3, k=4, ep=1) over Integer Ring

Best regards,
Simon

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