[IPython-dev] Doctests & Python 3
Tue Aug 23 17:24:17 CDT 2011
On 23 August 2011 22:33, Aaron Meurer <firstname.lastname@example.org> wrote:
> There is a -d option to 2to3 that should do the necessary
> transformations for you.
Indeed, and distribute should be doing that (albeit not via a command line
flag) in the build process. But it seems like it doesn't recognise IPython
doctests (with our "In :" style prompts). If anyone knows of a way to
extend it to pick that up, that would be the neatest solution, but I don't
know if it's possible.
> Also, if you don't actually use the fact that it's a function, you
> don't have to import print_function from __future__ to use the
> print(1) syntax in Python 2.
But print(1,2) will print a tuple, rather than "1 2". If we're going to go
down the route of using the new syntax for doctests, it should be simple
enough to use print_function. But it's not ideal to have to write all our
Python 2 doctests using Python 3 syntax (although I've already tweaked a few
minor bits, like list(range(n)) and a//b, for consistency).
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the IPython-dev