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 eric.smith
Recipients eric.smith, larry, levkivskyi
Date 2018-01-22.07:37:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1516606676.54.0.467229070634.issue32513@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2018-01-22 07:37:56eric.smithsetrecipients: + eric.smith, larry, levkivskyi
2018-01-22 07:37:56eric.smithsetmessageid: <1516606676.54.0.467229070634.issue32513@psf.upfronthosting.co.za>
2018-01-22 07:37:56eric.smithlinkissue32513 messages
2018-01-22 07:37:56eric.smithcreate