simplify key_list#1214
Conversation
ryneeverett
left a comment
There was a problem hiding this comment.
Is it required (or best practice) for type checking to declare the broadest possible type that a function can accept, even if the type is actually always much narrower? It strikes me as odd that unique_key_sets has a different type in every function: Iterable[Iterable[str]], Iterable[tuple[str, ...]], Iterable[Sequence[str]], set[tuple[str, ...]].
First a bit of theory: That's why I'm trying to be generic with the inputs (e.g. That said,
Sidenote: I think UNIQUE_KEY should be a frozenset instead of a tuple, but that's really nitpicking |
|
Thanks for the theory, that makes a lot of sense!
There was a time when pythonistas considered best practice to be to default to the most common data types and only use the more esoteric ones when doing so served a particular purpose. Perhaps this norm has changed as Python has moved further away from its scripting language roots and static analysis has gotten more thorough and useful. |
I don't see
But once again, that does not really matter here, let's keep a tuple for now. |
Simplify "key_list" type (and rename it)