bpo-43080: pprint for dataclass instances (GH-24389)

* Added pprint support for dataclass instances which don't have a custom __repr__.
This commit is contained in:
Lewis Gaul 2021-04-14 00:59:24 +01:00 committed by GitHub
parent 695d47b51e
commit 11159d2c9d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 133 additions and 14 deletions

View file

@ -28,6 +28,9 @@ Dictionaries are sorted by key before the display is computed.
.. versionchanged:: 3.9
Added support for pretty-printing :class:`types.SimpleNamespace`.
.. versionchanged:: 3.10
Added support for pretty-printing :class:`dataclasses.dataclass`.
The :mod:`pprint` module defines one class:
.. First the implementation class:

View file

@ -820,6 +820,12 @@ identification from `freedesktop.org os-release
<https://www.freedesktop.org/software/systemd/man/os-release.html>`_ standard file.
(Contributed by Christian Heimes in :issue:`28468`)
pprint
------
:mod:`pprint` can now pretty-print :class:`dataclasses.dataclass` instances.
(Contributed by Lewis Gaul in :issue:`43080`.)
py_compile
----------