bool and int surprise

9 views
Skip to first unread message

smichr

unread,
Oct 27, 2012, 5:24:22 AM10/27/12
to sy...@googlegroups.com
I knew that True == 1 is True and True is 1 is False but I did not expect that isinstance(True, int) to be True! 

caveat emptor-ily,
 Chris

Aaron Meurer

unread,
Oct 27, 2012, 3:31:34 PM10/27/12
to sy...@googlegroups.com
That's the whole reason why it works. True and False can be replaced for 1 and 0 anywhere. True + 4, a[True], etc. They all work. 

Aaron Meurer
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To view this discussion on the web visit https://groups.google.com/d/msg/sympy/-/HD1LsNnUVGkJ.
To post to this group, send email to sy...@googlegroups.com.
To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
Reply all
Reply to author
Forward
0 new messages