6 ms·
Am I missing something, why wouldn't a non-homogeneous array literal pass?
by okayexplainl4 4y ago
Am I missing something, why wouldn't a non-homogeneous array literal pass?
- insanitybit 4y agoBecause mixing types in an array is stupid enough that I thought it might just not be valid.
- ris 4y agoMixing types in an array/list is not remotely stupid. How exactly would you suggest expressing the lack of a value in a series of numbers without None/null? There's your mixed types. Don't let weird dogma get in the way of practicality.
- insanitybit 4y agoJSON has a `null` value already, and null is its own special case in most languages where `null` is a universal type. Otherwise you tag your data so that it's an array of objects.
- qwefsdf 4y agoThat's an Optional[int]. It's not "mixed types", it's a union type.
- ris 4y agoThat is merely a detail of how the typing module has decided to set up convenient aliases. Treated by the language (and likely compilers) as different types.