ipython/ipython — pull request #2095 by Carreau (2012-07-04 12:33:11+00:00)
Title: [in progress] python 2 and 3 compatibility without 2to3

Logical step after #2064 where the discussion started.

Most of the fixes apply by `2to3` when converting the current source tree to python 3 can be applied and are valid python 2.6 and 2.7 (not 2.5 but we don't support it), with minimal changes.

The plan is here to apply theses changes as early as possible ans deactivate them when using `2to3` in order to get a python2 and python3 compatible IPython code.

For what I've seen right now, 2to3 is sometime a little overzealous with `print`, converting
`print 'xxx',` to `print('xxx', end=' ')`(space) but in some place we should have `end=''`(no space),
and it sometime also change `print ('an'+'expression')` to `print(('an'+'expression'))`. I detected and fixed some by hand because of failling test, but might have missed a few.

The other 2 fixes I added was getting rid of `apply` in some places, and convert `exec` statement to a function.

My guess is the harder part will be unicode strings prefix that is not valid python 3.0 to 3.2 and valid again python 3.3. One of our option might be `from __future__ import unicode_literals`.

It would be really cool to be able to do `python3 ipython.py`

Note : this is on top of #2064, we can either close #2064, or I'll rebase when #2064 is merged.