My favorites | Sign in
Logo
                
New issue | Search
for
| Advanced search | Search tips
Issue 1262: fix sympy to work in python3.0
4 people starred this issue and may be notified of changes. Back to list
Status:  Accepted
Owner:  ----
Type-Defect
Priority-High
Milestone-Release0.7.0


Sign in to add a comment
 
Reported by ondrej.certik, Jan 11, 2009
The 2to3 code converts sympy just fine, but then one needs to apply this patch:

----------------------------- sympy/core/logic.py -----------------------------
index d3ae4ec..293f947 100644
@@ -66,6 +66,16 @@ def __ne__(a, b):
         else:
             return a.args != b.args
 
+    def __lt__(cls, other):
+        if cls.__cmp__(other)==-1:
+            return True
+        return False
+
+    def __gt__(cls, other):
+        if cls.__cmp__(other)==1:
+            return True
+        return False
+
 
     def __cmp__(a, b):
         if type(a) is not type(b):


and then fix the imports in sympy/core. Then it could start working.

The way to fix the imports is to just use regular "import something"
syntax, but do not inject things into other modules, because python3.0 is
more strict and this doesn't work.
Comment 1 by ondrej.certik, Jan 11, 2009
(No comment was entered for this change.)
Labels: -Priority-Medium Priority-High
Comment 2 by fabian.seoane, Jan 23, 2009
I think this is important, raising to milestone 0.6.4
Labels: Milestone-Release0.6.4
Comment 3 by fabian.seoane, Jan 31, 2009
running with python2.6's -3 flag output's some useful warnings.
Comment 4 by ondrej.certik, Feb 08, 2009
(No comment was entered for this change.)
Labels: -Milestone-Release0.6.4 Milestone-Release0.6.5
Comment 5 by ondrej.certik, Jul 05, 2009
See this thread for latest updates:

http://groups.google.com/group/sympy/browse_thread/thread/9b730436cf602a64
Comment 6 by ondrej.certik, Jul 13, 2009
(No comment was entered for this change.)
Labels: Milestone-Release0.6.6
Comment 7 by smichr, Aug 18, 2009
see also  Issue 1605 .
Comment 8 by asmeurer, Sep 06, 2009
Another thing that will have to change is that Python 3 does not support cmp functions for sorting anymore.  You 
have to use a key function.  I know at least Basic._compare_pretty() and compare_ode_sol() in ode.py are cmp 
functions, but I am sure there are others.      
Comment 9 by Ronan.L...@gmail.com, Nov 01, 2009
 Issue 1605  has been merged into this issue.
Comment 10 by Ronan.L...@gmail.com, Nov 29, 2009
Using the -3 switch (e.g. "python -3 bin/test") is a good way to check what has to be
done. The real problems are sorting with a cmp instead of a key, and overriding
__eq__ or __cmp__ without overriding __hash__.
Comment 11 by Vinzent.Steinberg, Dec 01, 2009
(No comment was entered for this change.)
Labels: -Milestone-Release0.6.6 Milestone-Release0.7.0
Sign in to add a comment

Hosted by Google Code