[New-bugs-announce] [issue17150] pprint could use line continuation for long string literals

Antoine Pitrou report at bugs.python.org
Thu Feb 7 13:51:07 CET 2013


New submission from Antoine Pitrou:

Currently:

>>> pprint.pprint({"a": "xxx " * 50})
{'a': 'xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx '}

It would be nicer if it produced something like:

>>> pprint.pprint({"a": "xxx " * 50})
{'a': 'xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx '
      'xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx '
      'xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx '
      'xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx '
      'xxx xxx xxx xxx xxx xxx xxx xxx xxx xxx '}

(for the record, the real-world use case I encountered was when printing some pyudev data)

----------
components: Library (Lib)
messages: 181599
nosy: fdrake, pitrou
priority: normal
severity: normal
status: open
title: pprint could use line continuation for long string literals
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17150>
_______________________________________


More information about the New-bugs-announce mailing list