tefra / xsdata

Naive XML & JSON Bindings for python
https://xsdata.readthedocs.io
MIT License
310 stars 56 forks source link

Question: Ability to add ` field(repr=False)` for specific fields? #1050

Closed afuetterer closed 1 month ago

afuetterer commented 1 month ago

Hi, a quick question: Is it possible to define in the config, that some fields of the autogenerated dataclasses should not be part of the repr method?

I would like to have the repr method, but actually for inspecting the objects, I don't need all the fields in the output. Does this make sense?

tefra commented 1 month ago

It would be extremely difficult and painful to add this in main library @afuetterer

I strongly believe __repr__ should return a string representation that can be executed and return exactly the same value.

afuetterer commented 1 month ago

Alright, I see. Let me close this then.