I was astonished that `typing.Maybe[T]` doesn't already exist, but if it did exist, surely it would have to be `Union[T, None]`. Ah wait, that would be spelled "Optional".
As for the pseudo-type `False` meaning "any falsey value", I don't think that tracking the *value* of variables is something that the current generation of type checkers are capable of. Consider: text = input() flag = "x" in text We can infer that text is a string, but not whether it is a truthy string or a falsey string; we can infer that flag is a bool, but not whether it is True or False. Adding variable annotations is no help, because the annotations have to be added when we edit the code, but whether or not the values are truthy or falsey isn't generally known until the code is run. And the type checker runs at the intermediate time where the code is compiled: 1. Edit time. 2. Compile time (includes linters, the parser, etc). 3. Run time. We can only annotate information known at stage 1; the type checker can only check things known at stage 2; but the value of most things are only known at stage 3. -- Steve _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/7436CHZFSN4X5FFC253AXWMYQIDZH3ZG/ Code of Conduct: http://python.org/psf/codeofconduct/