On Thu, Jan 2, 2014 at 8:01 AM, Nils Bruin <[email protected]> wrote:
> On Thursday, January 2, 2014 2:42:13 AM UTC-8, Peter Bruin wrote:
>>
>> Except that currently (if A is the codomain) A.__call__() looks for a
>> conversion and calls it, where the default conversion consists of calling
>> A._element_constructor_(), so just letting the conversion f be the callable
>> A itself instead would create a circularity (A(x) = A.__call__(x) = f(x) =
>> A(x) = ...).  To implement your proposal, one could return "lambda x: return
>> A._element_constructor_(x)" as the conversion.
>
> No, it could simply be (a weak reference to) A._element_constructor_, (yes,
> bound methods turn out to allow weak references!). A benefit would be that
> we do not need superfluous wrappers.
>
> This brings up another point:I think the mail reason for reifying a
> "conversion" in the first place is because we want them cached for
> efficiency reasons. If they're going to be _element_constructor_ all the
> time anyway, I'm not so sure we need to cache them.

They're not always _element_constructor_, in particular, when it
exists, they should be the (partial) inverses of coercion maps (which
is automatically detected). It is unfortunate that conversions
encapsulate everything from section like Z/nZ -> Z and canonical
partial maps Q -> GF(p) to non-map constructors like list/dict -> Z[x]
to nonsense like GF(p) -> GF(q).

- Robert

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

Reply via email to