Larry Hastings <la...@hastings.org> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32513>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to