I added a note about this to the release notes for the next version. https://github.com/sympy/sympy/wiki/release-notes-for-0.7.4#other
Aaron Meurer On Sat, Aug 31, 2013 at 10:35 AM, Aaron Meurer <[email protected]> wrote: > Yes, this is absolutely intended. Things like > > if x < y: > ... > > no longer work, unless x - y is explicitly known to be negative or > nonnegative. This fixes a lot of subtle bugs that pop up, because > people will write things like the above expecting x and y to be > numbers, but when symbols are passed in, it would arbitrarily be True > or False. > > This also fits with the Python 3 idiom that you can't order things > unless they have a well-defined order to them. > > If you want a canonical (but arbitrary) way to order SymPy > expressions, use default_sort_key, like > > sorted(syms, key=default_sort_key) > > It was designed for this exact purpose. > > Aaron Meurer > > > On Sat, Aug 31, 2013 at 1:35 AM, Matthew Brett <[email protected]> > wrote: >> Hi, >> >> I just noticed this in current master (not in 0.7.3): >> >> In [4]: from sympy import symbols >> >> In [5]: syms = symbols('c, b, a') >> >> In [6]: sorted(syms) >> --------------------------------------------------------------------------- >> TypeError Traceback (most recent call last) >> <ipython-input-6-dcb7d6a54d2e> in <module>() >> ----> 1 sorted(syms) >> >> /Users/mb312/usr/local/lib/python2.7/site-packages/sympy/core/relational.py >> in __nonzero__(self) >> 224 >> 225 def __nonzero__(self): >> --> 226 raise TypeError("symbolic boolean expression has no >> truth value.") >> 227 >> 228 __bool__ = __nonzero__ >> >> TypeError: symbolic boolean expression has no truth value. >> >> Is this intended? It's fairly easy to work around but it broke some >> of our code and I suppose it might be surprising. >> >> Cheers, >> >> Matthew >> >> -- >> 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 [email protected]. >> To post to this group, send email to [email protected]. >> Visit this group at http://groups.google.com/group/sympy. >> For more options, visit https://groups.google.com/groups/opt_out. -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/sympy. For more options, visit https://groups.google.com/groups/opt_out.
