[Python-Dev] Is static typing still optional?
Raymond Hettinger
raymond.hettinger at gmail.com
Mon Jan 29 04:01:31 EST 2018
> On Jan 28, 2018, at 11:52 PM, Eric V. Smith <eric at trueblade.com> wrote:
>
> I think it would be a bad design to have to opt-in to hashability if using frozen=True.
I respect that you see it that way, but it doesn't make sense to me. You can have either one without the other. It seems to me that it is clearer and more explicit to just say what you want rather than having implicit logic guess at what you meant. Otherwise, when something goes wrong, it is difficult to debug.
The tooltips for the dataclass decorator are essentially of checklist of features that can be turned on or off. That list of features is mostly easy-to-use except for hash=None which has three possible values, only one of which is self-evident.
We haven't had much in the way of user testing, so it is a significant data point that one of your first users (me) found was confounded by this API. I recommend putting various correct and incorrect examples in front of other users (preferably experienced Python programmers) and asking them to predict what the code does based on the source code.
Raymond
More information about the Python-Dev
mailing list