16.07.20 07:34, Charles Machalow пише:
Right now in str.format(), we have !s, !r, and !a to allow us to call str(),
repr(), and ascii() respectively on the given expression.
I'm proposing that we add a !p conversion to have pprint.pformat() be called to
convert the given expression to a 'pretty' string.
I do not think it is a good idea. pprint is a kind of toy module. It
supports only limited set of standard collection classes and is not
extensible. It does not even know anything about named tuples and
dataclasses. It does not support multiline reprs. It is inconsistent in
sorting set items. Its output format looks strange and is not PEP 8
compatible. It requires specifying the width.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/python-ideas@python.org/message/UPYUJEHSYWGVJJLVDCGV4G222GH763MT/
Code of Conduct: http://python.org/psf/codeofconduct/