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

Gael Varoquaux gael.varoquaux at normalesup.org
Sat Aug 15 19:08:29 EDT 2009


On Sat, Aug 15, 2009 at 05:57:45PM -0500, Robert Kern wrote:
> 2009/8/15 Stéfan van der Walt <stefan at sun.ac.za>:
> > 2009/8/15 Emmanuelle Gouillart <emmanuelle.gouillart at normalesup.org>:
> >>> At this point in this thread, I've reached the "strong opinion" that I'm +1 w/ Charles: speaking as someone who's gung-ho to make the docstrings as pedagogically useful as possible, I feel code-docstring consistency trumps this - IMO, the docstrings should not be be changed prior to the code itself being changed.

> >> OK, you can revert the changes very easily as I paid attention to save
> >> versions including only the modifications of print statements.

> > Don't revert those changes.  Using "print" as a function is more
> > consistent in style (one of the reasons it's been changed in 3.0).
> > Doing it now saves us a lot of trouble later on.

> print is simply not a function in 2.x. Abusing the Python 2.x syntax
> to pretend like it is a function is terribly inconsistent when showing
> Python 2.x code.

Well, actually, it seems that this is not completely true in 2.6. Print
seems to be both a statement and a builtin function (for this to work, I
can only think that the Python devs added some custom logic to the
parser). This is what confuses IPython. The strange thing is that they
behave differently. You can test this outside of IPython.

So you are advocating no transition period between print as a statement,
and print as a function, because if we are going to bite a bullet, we
might as well understand what we bite, right?

Gaël



More information about the SciPy-Dev mailing list