# HG changeset patch
# User Burcin Erocal <burcin@erocal.org>
# Date 1308253420 -7200
# Node ID 654539ac75fb05f46dcf318d2887c4faba46542a
# Parent efb39ad24731582fa9a0179bfb4aa3a8cb806e1f
Use printing order for operands access and comparison of symbolic expressions.
diff --git a/sage/libs/ginac.pxd b/sage/libs/ginac.pxd
a
|
b
|
|
92 | 92 | GEx rhs() except + |
93 | 93 | GEx lhs() except + |
94 | 94 | int nops() except + |
95 | | GEx op(int i) except + |
| 95 | GEx op "sorted_op" (int i) except + |
96 | 96 | GEx eval(int level) except + |
97 | 97 | GEx evalf(int level, object parent) except + |
98 | 98 | GEx conjugate() except + |
… |
… |
|
533 | 533 | py_funcs_struct py_funcs "GiNaC::py_funcs" |
534 | 534 | |
535 | 535 | cdef extern from "pynac/order.h": |
| 536 | bint print_order_compare "GiNaC::print_order().compare" \ |
| 537 | (GEx left, GEx right) except + |
536 | 538 | bint print_order "GiNaC::print_order()" \ |
537 | 539 | (GEx left, GEx right) except + |
538 | 540 | bint print_order_mul "GiNaC::print_order_mul()" \ |
diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx
a
|
b
|
|
2862 | 2862 | return (<Element>left)._cmp(right) |
2863 | 2863 | |
2864 | 2864 | cdef int _cmp_c_impl(left, Element right) except -2: |
2865 | | return left._gobj.compare((<Expression>right)._gobj) |
| 2865 | return -print_order_compare((<Expression>right)._gobj,left._gobj) |
2866 | 2866 | |
2867 | 2867 | cpdef int _cmp_add(left, CommutativeRingElement right) except -2: |
2868 | 2868 | return print_order(left._gobj,(<Expression>right)._gobj) |
… |
… |
|
4087 | 4087 | while itr.is_not_equal(sym_set.end()): |
4088 | 4088 | res.append(new_Expression_from_GEx(SR, itr.obj())) |
4089 | 4089 | itr.inc() |
| 4090 | res.sort(cmp=lambda x,y: cmp(x,y)) |
4090 | 4091 | return tuple(res) |
4091 | 4092 | |
4092 | 4093 | def arguments(self): |