Now that use of formatting tools is becoming pretty common, would it make any sense if the pretty print module could be extended to understand some of these (e.g. a style=
kwarg)? To illustrate, if I snip the example from the pprint doc and put in a Python script I run black on, I’ll have something like:
pkginfo = {
"author": "The Python Packaging Authority",
"author_email": "pypa-dev@googlegroups.com",
"bugtrack_url": None,
"classifiers": [
"Development Status :: 3 - Alpha",
"Intended Audience :: Developers",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 2",
"Programming Language :: Python :: 2.6",
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.2",
"Programming Language :: Python :: 3.3",
"Programming Language :: Python :: 3.4",
"Topic :: Software Development :: Build Tools",
],
and if I pprint that it comes out as:
{ 'author': 'The Python Packaging Authority',
'author_email': 'pypa-dev@googlegroups.com',
'bugtrack_url': None,
'classifiers': [ 'Development Status :: 3 - Alpha',
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python :: 2',
'Programming Language :: Python :: 2.6',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.2',
'Programming Language :: Python :: 3.3',
'Programming Language :: Python :: 3.4',
'Topic :: Software Development :: Build Tools'],
Which is by no means wrong, but it’s a little irritating that it’s laid out differently than the original…