Re: Fix Basic.__lt__() and friends for noncommutative symbols (issue 1878)

2010-03-29 Thread jegerjensen
> I think we should get rid of cmp in the long term. It's not supported in > Python 3 and it is confusing to use comparisons just for canonical ordering. > This should be rather in an own function, there is also the 'key' keyword > argument to the built-in sort(). I just realized that changing to

Re: [PATCH] Fix Basic.__lt__() and friends for noncommutative symbols (issue 1878)

2010-03-29 Thread Øyvind Jensen
great, thanks! ma., 29.03.2010 kl. 18.53 +0200, skrev Vinzent Steinberg: > 2010/3/29 Øyvind Jensen : > > Fixed the spacing and pushed to tha branch fix__lt__3. > > > > The parentheses around (a < b) are necessary, else it is interpreted as > > assert (a < b == Lt(a, b)). > > Thanks, this is in! >

Re: [PATCH] Fix Basic.__lt__() and friends for noncommutative symbols (issue 1878)

2010-03-29 Thread Vinzent Steinberg
2010/3/29 Øyvind Jensen : > Fixed the spacing and pushed to tha branch fix__lt__3. > > The parentheses around (a < b) are necessary, else it is interpreted as > assert (a < b == Lt(a, b)). Thanks, this is in! Vinzent -- You received this message because you are subscribed to the Google Groups

Re: [PATCH] Fix Basic.__lt__() and friends for noncommutative symbols (issue 1878)

2010-03-29 Thread Øyvind Jensen
Fixed the spacing and pushed to tha branch fix__lt__3. The parentheses around (a < b) are necessary, else it is interpreted as assert (a < b == Lt(a, b)). Øyvind ma., 29.03.2010 kl. 13.21 +0200, skrev Vinzent Steinberg: > 2010/3/29 Øyvind Jensen : > >> I think he meant to put commutative=False,

Re: [PATCH] Fix Basic.__lt__() and friends for noncommutative symbols (issue 1878)

2010-03-29 Thread Vinzent Steinberg
2010/3/29 Øyvind Jensen : >> I think he meant to put commutative=False, not noncommutative=True. > > Exactly, I put up another branch fix__lt__2, where this is fixed. Thanks! I'm +1 for this one. I have only a few minor stylistic remarks: +assert (ab) == Gt(a,b) +assert (a>=b) == Ge(a,b)

Re: [PATCH] Fix Basic.__lt__() and friends for noncommutative symbols (issue 1878)

2010-03-29 Thread Øyvind Jensen
> I think he meant to put commutative=False, not noncommutative=True. Exactly, I put up another branch fix__lt__2, where this is fixed. > It's weird that Symbol will let you create nonexistent assumptions > on it: But that can be quite useful: In [4]: r = Symbol('r',something=True) In [5]: r

Re: [PATCH] Fix Basic.__lt__() and friends for noncommutative symbols (issue 1878)

2010-03-28 Thread Aaron S. Meurer
On Mar 28, 2010, at 2:50 PM, Vinzent Steinberg wrote: > 2010/3/28 Øyvind Jensen > All comparisons of for non-commutative symbols used to return False. Now > an Inequality or StrictInequality is returned instead. > > Added a test. > --- > sympy/core/basic.py| 12 +--- > sy

Re: [PATCH] Fix Basic.__lt__() and friends for noncommutative symbols (issue 1878)

2010-03-28 Thread Vinzent Steinberg
2010/3/28 Øyvind Jensen > All comparisons of for non-commutative symbols used to return False. Now > an Inequality or StrictInequality is returned instead. > > Added a test. > --- > sympy/core/basic.py| 12 +--- > sympy/core/tests/test_basic.py |8 > 2 files c

Re: Fix Basic.__lt__() and friends for noncommutative symbols (issue 1878)

2010-03-28 Thread Aaron S. Meurer
Brian and I were talking about this on IRC a while back. Basic.__cmp__ is really easy to fix. There is a canonical ordering of classes defined in the ordering_of_classes list at the top of basic.py. All we need to do to turn this into a key function is to have it return the position in the li

Re: Fix Basic.__lt__() and friends for noncommutative symbols (issue 1878)

2010-03-28 Thread Vinzent Steinberg
2010/3/28 jegerjensen > This is the other patch: > > commit 7c4d48d8765a4f5aa621393b8d5e65be0ce32f4e > Author: Øyvind Jensen > Date: Sun Mar 28 16:06:35 2010 +0200 > >Commutator in secondquant.py should use cmp() instead of a > diff --git a/sympy/physics/secondquant.py b/sympy/physics/ > s

Re: Fix Basic.__lt__() and friends for noncommutative symbols (issue 1878)

2010-03-28 Thread jegerjensen
This is the other patch: commit 7c4d48d8765a4f5aa621393b8d5e65be0ce32f4e Author: Øyvind Jensen Date: Sun Mar 28 16:06:35 2010 +0200 Commutator in secondquant.py should use cmp() instead of a>> from sympy.physics.secondquant import Commutator >>> A, B = symbols('A B', commutative=False

Re: Fix Basic.__lt__() and friends for noncommutative symbols (issue 1878)

2010-03-28 Thread jegerjensen
Ooops! it turns out I actually got a failing doctest in secondquant.py... Sorry about that. This was because of a comparison a>b that should have used cmp(), and the fix is obvious. Two patches are now uploaded on github in the branch fix__lt__ http://github.com/jegerjensen/sympy/tree/fix__lt__

Re: [PATCH] Fix Basic.__lt__() and friends for noncommutative symbols (issue 1878)

2010-03-28 Thread Toon Verstraelen
Řyvind Jensen wrote: All comparisons of for non-commutative symbols used to return False. Now an Inequality or StrictInequality is returned instead. Added a test. All tests pass for me. The coding is clean. I'm not very familiar with sympy core, but it is good as far as I can tell. cheers,

[PATCH] Fix Basic.__lt__() and friends for noncommutative symbols (issue 1878)

2010-03-28 Thread Øyvind Jensen
All comparisons of for non-commutative symbols used to return False. Now an Inequality or StrictInequality is returned instead. Added a test. --- sympy/core/basic.py| 12 +--- sympy/core/tests/test_basic.py |8 2 files changed, 13 insertions(+), 7 deletions(-)