
Feb. 11, 2021
7:53 a.m.
(1) Is it really a TypeGuard, or more of a TypeAssertion? (2) Does this push too hard on "annotations only have one meaning"? If it has to imported from typing, then probably not, but I think that is worth adding to the PEP. (3) Why can't the falsey case of an Optional String narrow to a set of literals {"", None} Are you worried that a subclass of str might have its own empty string, or just that you don't want to promise this? As written, it sounds like such a narrowing is forbidden. -jJ