Hi,

At Sage Days 24, I learned that Python allows the user to do arithmetic
with bools:

In [1]: 5+True
Out[1]: 6

In [2]: True + False
Out[2]: 1

In [3]: 5+False
Out[3]: 5

Sage seems to follow this convention as well:

sage: 5 + True
6
sage: 5. - True
4.00000000000000

I can't see any use cases for this convention. I believe all these
examples should just raise a TypeError. IMHO, code relying on this
feature is very likely to be buggy.

Apparently the symbolic ring doesn't handle things so well [1], but I'm
not decided what the "fix" should be. :)

[1] http://trac.sagemath.org/sage_trac/ticket/9560

Any comments?


Cheers,
Burcin

-- 
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