Thank you very much for these explanations.
I will have a look at the facade mechanism. 

Best wishes,

Eric.

Le lundi 2 juin 2014 16:59:27 UTC+2, Simon King a écrit :

>
> If you rely on the default mechanisms and establish a coercion from B to 
> A, then 
>   A.zero() == B.zero() 
> is equivalent to 
>   A.zero() == A(B.zero()) 
> Presumably A(B.zero()) will return A.zero(). 
> Hence, probably you do not need to do anything special to establish 
> equality of A.zero() and B.zero(). 
>
> Probably it would be possible to implement the sub-structur B of A with 
> "facade parents". See, for example, Primes.__init__. This means that the 
> the elements of B are actually elements of A, i.e. 
>   sage: B.zero().parent() is A 
>   True 
>   sage: B.zero() is A.zero() 
>   True 
>
> However, if you decide that B has features that are sufficiently 
> different from A, you can implement a "usual" parent-element relation, 
> hence 
>   sage: B.zero().parent() is A 
>   False 
>   sage: B.zero().parent() is B 
>   True 
>   sage: B.zero() is A.zero() 
>   False 
>
> Cheers, 
> 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 http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to