[SciPy-dev] change print statements to print functions in docstrings

Charles R Harris charlesr.harris@gmail....
Sat Aug 15 11:44:01 CDT 2009

On Sat, Aug 15, 2009 at 10:24 AM, Ralf Gommers

> On Sat, Aug 15, 2009 at 11:37 AM, Charles R Harris <
> charlesr.harris@gmail.com> wrote:
>> On Sat, Aug 15, 2009 at 7:59 AM, Emmanuelle Gouillart <
>> emmanuelle.gouillart@normalesup.org> wrote:
>>>        Hi,
>>>        I've started changing the print statements in numpy's doctrings
>>> to print functions on the doc wiki, to meet the requirements of Python
>>> 3.0. Any objections or comments?
>> This can lead to some oddities:
>> In [6]: print(1,2,3)
>> (1, 2, 3)
>> I think it might be better to find out what  2to3 does in these
>> circumstances first.
> From the 2to3 docs:
> "2to3 can also refactor doctests. To enable this mode, use the -d f**<http://docs.python.org/using/cmdline.html#cmdoption-d>lag.
> Note that *only* doctests will be refactored. This also doesn’t require
> the module to be valid Python. For example, doctest like examples in a reST
> document could also be refactored with this option."
> Anyway, the change can also be made with a good editor and search-replace.
> I am all for changing this, my point was simply that the doc wiki is not the
> best tool to make changes like these (not that I don't love the doc wiki,
> it's great).

I'm not convinced it is a good idea, even pedagogically. First, all the
python books I have are for the python-2.x versions, and second it saddles
the students with having to make a distinction between printing single items
vs printing multiple items. It's better, I think, to wait until we have a
python 3.x version of numpy.

That said, it would be interesting if someone ran some tests using 2to3 just
to see how it works.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-dev/attachments/20090815/69e3135b/attachment.html 

More information about the Scipy-dev mailing list