This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author marystern
Recipients marystern
Date 2009-08-20.14:21:04
SpamBayes Score 2.4204305e-11
Marked as misclassified No
Message-id <1250778066.89.0.880851114314.issue6743@psf.upfronthosting.co.za>
In-reply-to
Content
Using print in python 3 I would like to simple "replace" print with
pprint.pprint. However pprint cannot be called with no arguments, so
this cannot currently be done (the error is "TypeError: pprint() takes
at least 1 positional argument (0 given)").

A simple improvement is to allow no object to be passed in and pprint
would then print a newline rather than fail.

Another problem is that if you try this:

 print('hello', True)

and replace print with print, the second arg gets interpreted as the
"stream" parameter.


Both of the above can be fixed (I think) by changing pprint.py as follows:

instead of the current code:
def pprint(object, stream=None, indent=1, width=80, depth=None):

change to this:
def pprint(object='\n', *args, stream=None, indent=1, width=80, depth=None)
History
Date User Action Args
2009-08-20 14:21:07marysternsetrecipients: + marystern
2009-08-20 14:21:06marysternsetmessageid: <1250778066.89.0.880851114314.issue6743@psf.upfronthosting.co.za>
2009-08-20 14:21:05marysternlinkissue6743 messages
2009-08-20 14:21:05marysterncreate