On Jun 21, 2010, at 10:52 AM, James Pearson wrote: > On Mon, Jun 21, 2010 at 1:38 AM, Christophe BAL <[email protected]> wrote: > Hello, > do you think that one day sympy will be avaible for Python 3 ? > > Considering that Python 3.0 was released in December '08, it would be nice to > see SymPy at least start moving in that direction.
Yes. I agree. Although, the real benchmark should be how many other projects have ported and how many people have moved, not when it came out. > > The difficulty is that Python3 is backwards-incompatible, meaning that either > two concurrent branches must be maintained, or SymPy has to switch completely > at some point in time. The latter is difficult due to a sort of Catch-22 > with libraries - people don't move over their projects to Py3 because they > rely on other code that hasn't moved, and the other code hasn't moved because > of the same thing. > SymPy is designed to be without any dependencies. However, one way that we include the pyglet and mpmath libraries directly in sympy, and any changes to those have to be backported to their respective projects. Ondrej has stated that he thinks we should remove pyglet and make it an optional external library. But this is not going to happen for mpmath. So we have basically one project that needs to be ported first or concurrently, which is not too bad compared to most major Python libraries. > Now, I've been told that 2to3 should work perfectly, and any issues with the > code generated from it are actually things that should be fixed in the Python > 2.x codebase. I've also been told that that's bollocks. 2to3 does not work perfectly. It can't by the nature of the language. Utilities like 2to3 work by statically analyzing the code, which works 99% of the time because people usually do not take advantage of the dynamic features of the language. But there will always be code that is just a hack that will break (and I guarantee you there is in SymPy). For example, any code that works by building up a string to be passed to the exec statement will not be fixed by 2to3 if the code in the string is potentially incompatible with Python 3. Also, I have come across things that will not work in Python 3 and are not fixed by 2to3 or caught by -3 (see [1]) According to the Python docs, the first step is to fix things that also work in Python 2.6 using the -3 switch to Python 2.6 [0]. This is probably the most difficult step, because it requires making non-trivial changes like converting cmp functions into key functions. You can run python2.6 -3 bin/test in the sympy directory to see what the current problems are. These can be fixed immediately, without ever having to run Python 3. After that, we can try passing things to 2to3 and seeing how they work. Note that even if this works perfectly, we still need to setup some kind of 2to3 buildbot that handles the conversion automatically after each commit. I wouldn't be surprised if someone has already written one of these, though. Aaron Meurer [0] - http://docs.python.org/py3k/whatsnew/3.0.html#porting-to-python-3-0 [1] - http://asmeurersympy.wordpress.com/2010/06/16/strange-python-behavior-can-someone-please-explain-to-me-what-is-going-on-here/ > > Anyways, there is a task[0] for it in the issue tracker, so you can keep > track of its progress there. There's also some discussion in this thread[1], > linked to from the issue. > > [0]: http://code.google.com/p/sympy/issues/detail?id=1262 > [1]: > http://groups.google.com/group/sympy/browse_thread/thread/9b730436cf602a64?pli=1 > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
