[IPython-user] IPython with Python 3.0

Jörgen Stenarson jorgen.stenarson@bostream...
Mon Dec 8 12:03:45 CST 2008


Fernando Perez skrev:
> """
> It is not recommended to try to write source code that runs unchanged
> under both Python 2.6 and 3.0; you'd have to use a very contorted
> coding style, e.g. avoiding print statements, metaclasses, and much
> more.
> """
> 
> I actually think that we might be able to do precisely the above,
> simply by wrapping all our print statements in a function that behaves
> like the new one.   We don't use metaclasses nor much of the recent
> fanciness, so all we need is for a codebase that *compiles* under 3.0,
> not one that runs.  At that point it will be possible to ship an
> ipython which *installs* under 3.0 even though only its core (no guis,
> no parallel computing) work.  Since that core has a large user base,
> this is a worthy goal, and it will put us in a position to begin
> building for 3.0 as our dependencies for the extra functionality catch
> up.
> 
I think the new except syntax (PEP 3110) where "except exc, var" 
changes to "except exc as var" is a bigger problem than print in getting 
ipython to compile directly on both 2.x and 3.0. I counted 78 occurences 
of this usage of the except statement in the ipython codebase.

/Jörgen



More information about the IPython-user mailing list