For is_foo, you can use "is False", but for an inequality, it returns a sympified boolean, because that is an example of a case where the expression might not be true or false, but a symbolic expression (like x > y). So a symbolic boolean makes sense in that case.
Aaron Meurer On Fri, Jun 27, 2014 at 2:21 PM, Chris Smith <smi...@gmail.com> wrote: > It's just that you have to explicitly use False or None to test an is_foo > result sometimes. And I'm so conditioned to use "is False" that when it > comes to testing the result of a relationship I do the same...but shouldn't > because (3>0) is True is False (because it's true, not True)....and I noted > also that the 'is' is tighter binding than the >-operator so (S(3)>S(2)) is > true is True while S(3)>S(2) is true is False. > > > On Friday, June 27, 2014 10:51:29 AM UTC-5, Aaron Meurer wrote: >> >> I think I'm losing track of your question here. is_foo can't use >> BooleanTrue because it isn't symbolic. It will never return an >> arbitrary boolean expression. Also, it uses three-valued logic, >> whereas BooleanTrue is explicitly two-valued. >> >> Aaron Meurer >> >> On Fri, Jun 27, 2014 at 7:36 AM, Chris Smith <smi...@gmail.com> wrote: >> > # Yes: if greeting: >> > # No: if greeting == True: >> > # Worse: if greeting is True: >> > >> > ok. but in the case of differentiating between None or False you have to >> > use >> > the literal. >> > >> > ...is_foo cane use is True but for bool it's bad... >> > >> > >> > On Thursday, June 26, 2014 10:47:01 AM UTC-5, Aaron Meurer wrote: >> >> >> >> Maybe >> >> https://github.com/sympy/sympy/blob/master/sympy/logic/boolalg.py#L81 >> >> can provide some insight here. >> >> >> >> Aaron Meurer >> >> >> >> On Thu, Jun 26, 2014 at 10:33 AM, Chris Smith <smi...@gmail.com> wrote: >> >> >>>> x.is_real is True >> >> > True >> >> >>>> var('x',positive=True) >> >> > x >> >> >>>> (x>0) is True >> >> > False >> >> >>>> x>0 >> >> > True >> >> >>>> type(_) >> >> > <class 'sympy.logic.boolalg.BooleanTrue'> >> >> > >> >> > >> >> > I understand that the above (x>0) is True is False for the same >> >> > reason >> >> > that >> >> > S(1) is 1 is False, but why don't boolean expressions use >> >> > BooleanTrue, >> >> > too? >> >> > Is that ust how Python works? >> >> > >> >> > -- >> >> > You received this message because you are subscribed to the Google >> >> > Groups >> >> > "sympy" group. >> >> > To unsubscribe from this group and stop receiving emails from it, >> >> > send >> >> > an >> >> > email to sympy+un...@googlegroups.com. >> >> > To post to this group, send email to sy...@googlegroups.com. >> >> > Visit this group at http://groups.google.com/group/sympy. >> >> > To view this discussion on the web visit >> >> > >> >> > >> >> > https://groups.google.com/d/msgid/sympy/1946215b-573f-4f0d-833a-18a1b32b504d%40googlegroups.com. >> >> > For more options, visit https://groups.google.com/d/optout. >> > >> > -- >> > You received this message because you are subscribed to the Google >> > Groups >> > "sympy" group. >> > To unsubscribe from this group and stop receiving emails from it, send >> > an >> > email to sympy+un...@googlegroups.com. >> > To post to this group, send email to sy...@googlegroups.com. >> > Visit this group at http://groups.google.com/group/sympy. >> > To view this discussion on the web visit >> > >> > https://groups.google.com/d/msgid/sympy/3c5ec683-9b5d-40d9-804c-ccb69f7ebded%40googlegroups.com. >> > >> > For more options, visit https://groups.google.com/d/optout. > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sympy+unsubscr...@googlegroups.com. > To post to this group, send email to sympy@googlegroups.com. > Visit this group at http://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/c8f76e8f-0a04-42f2-a63d-8a026cfa6714%40googlegroups.com. > > For more options, visit https://groups.google.com/d/optout. -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6L%3Dee2W37TWbfmS8%2BO4aA42T6tdD6J-NosRof9kuLRX8w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.