[issue43080] pprint for dataclass instances

Eric V. Smith report at bugs.python.org
Mon Mar 15 20:41:28 EDT 2021


Eric V. Smith <eric at trueblade.com> added the comment:

I'm leaning toward accepting this on the condition that it only be invoked for dataclasses where __repr__ was the version generated by @dataclass. And also that it use the same fields that the generated __repr__ would use (basically skipping repr=False fields). Under those conditions, I don't see the harm.

The reason I'm leaning toward acceptance is that we've talked about a better pprint for ages, and yet there's no activity that I can tell toward developing a replacement in the stdlib. pprint was a motivating example for PEP 443 (singledispatch), and that was accepted 8 years ago. I don't think we should have to wait forever to get better pprint for dataclasses.

But I'm still not 100% decided, and I can be reasoned with!

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43080>
_______________________________________


More information about the Python-bugs-list mailing list