The language is explained here

http://www.sagemath.org/doc/tutorial/tour_coercion.html#conversion-versus-coercion


On Tuesday, October 28, 2014 8:06:44 PM UTC, Erik Massop wrote:
>
> sage: s = Sequence([], QQ) 
> sage: s.append(QQ(3)) # no coercion or conversion 
> sage: s.extend([int(1), ZZ(2)]) # 2 conversions 
>
> sage: s = Sequence([QQ(3)]) # no coercion or conversion 
> sage: s.extend([int(1), ZZ(2)]) # 2 coercions 
>

I guess so. The Sequence has a fixed universe once its created afair, so 
extending it is somewhat of a special case though.

int main () { 
>         float foo[2]; 
>         foo[0] = 1.00; /* no coercion or conversion */ 
>         foo[1] = 2L; /* conversion */ 
>         return 0; 
> } 
>

Of course in Python assignment can never be a type conversion since there 
are no types. The closest analog to coercion in C++ would be type promotion 
rules like

auto x = 1 + 0.5;



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

Reply via email to