Pretty printing dataclasses #891
-
Very impressed, just started trying it out, so quite new here. When I'm not tethered to an older Python, I love using dataclasses. I printed one out: Great colors! But now I'm greedy. I'd like nice spacing too, as that's jumbled and hard to read. Is there an automatic-ish way to get black-like spacing for the output of a data class, without going member by member with something like https://rich.readthedocs.io/en/latest/protocol.html#console-render (adding something is fine, but imagine I have quite a few of these)? Also, unrelated, adding links to make a new discussion to the issue template chooser is a good way to make discussions a bit more discoverable. :) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Yes, it would be nice to format Dataclasses similar to dicts. I did try, but it is more complex to introspect a dataclass than a dict. I might try again at some point.
Good idea. |
Beta Was this translation helpful? Give feedback.
Yes, it would be nice to format Dataclasses similar to dicts. I did try, but it is more complex to introspect a dataclass than a dict. I might try again at some point.
Good idea.