Sometimes fully qualified class names (with the module name) get pretty long and obscure the content. In my case, most/all of the classes involved are dataclasses, but from the code it looks like that's not relevant.
I realize you can register your own prettyprinters -- which I've also used for one of my classes -- but for this purpose that seems high-effort and perhaps error-prone. I ended up just editing the source code to never print class names as fully qualified, and that's great for what I'm doing right now.
Even nicer (but likely straying into a separate feature request), I'd love to be able to write something like this and not mutate any global state:
I see this issue has come up before, in https://github.com/tommikaikkonen/prettyprinter/issues/27, so forgive me if you've already considered this and rejected it.
Description
It would be great if we could write something like:
And then instead of class names like the following in the output of
prettyprinter.pformat
:I'd want to see instead:
Sometimes fully qualified class names (with the module name) get pretty long and obscure the content. In my case, most/all of the classes involved are dataclasses, but from the code it looks like that's not relevant.
I realize you can register your own prettyprinters -- which I've also used for one of my classes -- but for this purpose that seems high-effort and perhaps error-prone. I ended up just editing the source code to never print class names as fully qualified, and that's great for what I'm doing right now.
Even nicer (but likely straying into a separate feature request), I'd love to be able to write something like this and not mutate any global state: