This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author larry
Recipients eric.smith, larry, levkivskyi
Date 2018-01-22.08:58:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1516611494.91.0.467229070634.issue32513@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-01-22 08:58:14larrysetrecipients: + larry, eric.smith, levkivskyi
2018-01-22 08:58:14larrysetmessageid: <1516611494.91.0.467229070634.issue32513@psf.upfronthosting.co.za>
2018-01-22 08:58:14larrylinkissue32513 messages
2018-01-22 08:58:14larrycreate