I have in the meantime tracked this to ComplexIntervalField and 
RealIntervalField both overriding __call__ in a way that seems to preempt 
usual coercion from working.
Note that CIF(s2) fails, but CIF.coerce(s2) works just fine. It seems that 
CIF/RIF just end up calling 
ComplexIntervalFieldElement.__init__()/RealIntervalFieldElement.__init__() 
with whatever you pass (s2 in this case). 
RealIntervalFieldElement.__init__() will in a last-ditch effort do:

# try coercing to real
try:
    rn = self._parent._lower_field()(x)
    rn1 = self._parent._upper_field()(x)
except TypeError:
    raise TypeError, "Unable to convert number to real interval."

which ends up invoking the coercion framework to coerce s2 from 
K2->RR->RIF. ComplexIntervalFieldElement.__init__ seems to assume that `s2` 
is in fact just a real part, and fails to do something reasonable with it.

Can somebody familiar with how coercion is supposed to work confirm that 
the problem is that RIF/CIF are using some old variant instead of the 
coercion framework (if I read the documentation right one is supposed to 
override _element_constructor in favor of __call__)?

- Daniel

-- 
-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org



Reply via email to