Ability to deserialize to `NamedTuple` instead of `dict`
JLLeitschuh opened this issue · comments
Jonathan Leitschuh commented
NamedTuple
has some benefits, including being immutable, meaning that they have predictable hash code, and can be used in sets.
This could be expanded to supporting custom deserializers into domain-specific objects. For example, if you would like to be able to customize the deserialization of a response into a custom object.
Hanusz Leszek commented
Sorry, I won't do this.
- It would be a breaking change
- If we add this as an option, it will complicate type hints for no good reason
- If someone wants this, he can himself convert it to a NamedTuple from the Dict, with better performance as this can be applied only when needed
- the best code is no code at all