-
Notifications
You must be signed in to change notification settings - Fork 23
Closed
Labels
Description
In a typeshed PR the other day, a contributor tried to annotate an object with frozenset[list[str]]
. It's obviously impossible to have a frozenset
of lists, as lists aren't hashable, and so I was surprised that none of the CI checks raised an error.
I'm in two minds about whether adding a check for that here would be a good idea:
- It would be very difficult for us to reliably detect whether an object is hashable or not
- Ideally this is something that would be flagged by a type-checker, not a linter
- BUT it might be difficult for even a type-checker to detect whether or not an object is hashable.
- AND we could probably fairly easily hardcode a list of common mutable objects that can't be used in
set
s,frozenset
s ordict
keys. It wouldn't be comprehensive, but it would detect the most common errors.
What do we think? Worth doing?