I don’t see any of those problems as big as trying to guess is 42
a number or a string in an environment where you cannot reliably use quotes. More precisely,
- type hints can be added and they have also other benefits,
- unions can be handled by trying conversion with all types in the specified order (e.g. with
int | float
try integer conversion first and if it fails try float), and - ABCs can be handled by converting to concrete classes (e.g. with
Mapping
convert todict
).