Eric V. Smith <e...@trueblade.com> added the comment: Only hash has the tri-state True/False/None behavior, defaulting to None. It's this way because None is the "do what's rational, based on eq and frozen" behavior. None of the other parameters work this way.
There's a long issue in the attrs repo that describes how they came to this conclusion: https://github.com/python-attrs/attrs/issues/136. I think it makes sense. None of the dataclass parameters have a sentinel that would let me detect if the user provided a value or not. In the case of hash, I can't detect if they explicitly passed hash=None or just didn't provide a value. I've given this some thought, and couldn't come up with a use case for knowing this. For example, if init had a sentinel value of MISSING, what would the code ever do except start with: if init is sentinel: init = True ? In addition to your list of dunder-control-parameters, there's frozen. It determines if instances are immutable (to the extent that they can be made immutable). ---------- _______________________________________ 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