On 20/01/16 22:35, William Stein wrote:
On Wed, Jan 20, 2016 at 2:02 PM, Vincent Delecroix
<20100.delecr...@gmail.com> wrote:
Sorry... I found out! We can implement a _pushout_ in the parent. Very
simple. Sorry for the noise.

For completeness (when somebody finds this via a search) if you follow
the trac ticket, you'll see the nice simple code Vincent just wrote:

     def _pushout_(self, other):
         r"""
         Implement a pushout with real interval fields

         TESTS::

             sage: c = ComplexIntervalField(128).an_element()
             sage: r = RealIntervalField(64).an_element()
             sage: c + r
             1 + 1*I
             sage: r + c
             1 + 1*I
             sage: parent(c+r)
             Complex Interval Field with 64 bits of precision
         """
         from sage.rings.real_mpfi import RealIntervalField_class
         if isinstance(other, RealIntervalField_class):
             prec = min(self.prec(), other.prec())
             return ComplexIntervalField(prec)

Indeed, that is very nice, and it's hard to imagine something simpler.
Great job people who designed this (Robert Bradshaw et al.)!

For completeness, this feature with _pushout_ method was introduced more recently in #18182.

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