Conversation
|
Why is this needed? Inheriting from |
|
I explained in the docstring of the class - here you can choose which fields to exclude during calling instead of during implementation. This was needed quite often in the past during debugging |
|
Btw, the usage in tianshou is broken - Experiment is no longer a dataclass, so the mixin methods don't work (raise exceptions). Pushing a fix to main where the inheritance of this is removed in Experiment |
|
This is also possible with ToStringMixin if you implement a very simple wrapper around |
|
Sure, this is a better way to achieve this. Gonna adjust |
The dataclass cannot inherit from anything, because this breaks all examples. It is documented in the commit! |
|
I'm saying Experiment should not inherit from DataclassPprintMixin, not that Experiment should become a dataclass |
|
Note that the function I sketched above should not be added to ToStringMixin, because it goes against the principle of ToStringMixin using a fixed configuration, i.e. it results in vastly different behaviour between |
|
How about |
|
Anyway, not urgent, closing this for now. Seems like we won't be using the mixin anywhere soon (I was just porting Experiment, but it shouldn't have been used there anyway). We can keep it in the back of our heads, eventually remove the DataclassPprintMixin from tianshou |
|
I am still not convinced that there truly is a use case for this. |
|
I had used this on objects containing general info as well as some fields with large arrays. I want to see everything except the arrays. When printing everything, the arrays pollute the output. At the same time, I don't want to print each field individually (there were many). That's the use case |
|
Long-ish arrays should never be part of string representations. Short-lived debugging tasks that need to print them should just print them explicitly imo. If need be, one could add a function that explicitly prints the detail info that is normally left out. |
|
So to make it fit into the ToStringMixin concept, an interface that could make sense would be something like |
|
Yeah, that sounds good! Let's do this when the need arises, in the spirit of XP :) |
We use it in tianshou, I'd also like to use it in releal