Message 310404 - Python tracker (original) (raw)
So if I understand correctly: the default value of the "repr" parameter is True.
Decision matrix: does dataclass insert a repr into the class?
+-- row: argument passed in to decorator's repr parameter | | v | yes | no | <--- columns: does the class have a repr? -------+---------+---------+ True | ??? | yes | -------+---------+---------+ False | no | no | -------+---------+---------+
If the user specifies "repr=True", and also specifies their own repr in the class, does dataclasses stomp on their repr with its own? Does it throw an exception?
I still prefer the tri-state value here. In this version, the default value of the "repr" parameter would be None, and the decision matrix for inserting a repr looks like this:
+-- row: argument passed in to decorator's repr parameter | | v | yes | no | <--- columns: does the class have a repr? -------+---------+---------+ True | raise | yes | -------+---------+---------+ None | no | yes | -------+---------+---------+ False | no | no | -------+---------+---------+
But we've talked about using the tri-state default for all of these parameters before, and clearly you weren't swayed then, so I guess I've said my peace and I'll stop suggesting it.