if True means 1, then can you use 1 as a truth value in a conditional expression? In which case 0 would be false. What would 2 or 3 mean?
Lisp distinguishes numbers from nil. Usually nil means false, (though in Scheme, there is another "false" value and nil means the empty list. However, anything non-nil is true. When you say "most languages" I think you are mistaken unless you count C as "most languages". RJF On Jul 24, 5:00 pm, David Kirkby <david.kir...@onetel.net> wrote: > On 24 July 2010 22:29, Burcin Erocal <bur...@erocal.org> wrote: > > > Hi, > > > At Sage Days 24, I learned that Python allows the user to do arithmetic > > with bools: > > > In [1]: 5+True > > Out[1]: 6 > > I personally don't see anything wrong with that - True has long since > been defined as 1 in most languages, and False as 0. > > I just checked Mathematica 7 > > In[1]:= 12==12 > > Out[1]= True > > In[2]:= 1+% > > Out[2]= 1 + True > > In[3]:= 1+False > > Out[3]= 1 + False > > So it handles True and False differently from integers. > > Dave -- 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