On 2017-12-19, Jeroen Demeyer <[email protected]> wrote: > On 2017-12-18 18:31, Simon King wrote: >> One way to answer the question whether a coercion from A to B exists is >> by implementing the method B._coerce_map_from_. > > Right, I was asking the question because I need to implement such a > method for RIF and CIF.
What does _coerce_map_from_ have to do with NamedConversionMap? Typically, _coerce_map_from_ either returns "True" or "None". My understanding is that B._coerce_map_from_(A) returning "True" is a mathematical statement, i.e., it shouldn't depend on an implementation detail such as whether a conversion method is available or not. On the other hand, it *is* possible to return a map. So, of cource you could check in B._coerce_map_from_(A) whether a named conversion is available, and return it. But actually I wouldn't necessarily assume that a special conversion method qualifies as a coercion. For instance, it makes sense to have a named conversion method that maps reals to integers (by rounding). But that wouldn't qualify as a coercion. 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
