3 ms·
Let me restate. To prevent ugliness in typing, either * Python should have a way of declaring variables without setting them to None, so we can type hint them
by abdullahkhalids 4y ago
Let me restate. To prevent ugliness in typing, either
* Python should have a way of declaring variables without setting them to None, so we can type hint them to their actual types. Pre-declaration is very important for a prototyping language, and needs to be done in a way that the variable is visible to dir().
* Come up with a cleaner syntax than the wordy Optional[]. Thankfully, they have recently moved on from the ugly Union[a,b] to the more readable a | b. Something more readable could be done for Optional.
- travisjungroth 4y agoa: int b: str | None = None
- thatfunkymunki 4y agobut Optional[foo] is literally a union of foo | None already!