> On Sat, 13 Feb 2021 at 07:11, Steven D'Aprano <st...@pearwood.info> wrote: > > Without reading the PEP, how is anyone supposed to know that this > > returns a bool? >
By looking at the name, or at the return statements in the body. These are expected to be really short. Tooling can certainly easily be taught what TypeGuard[...] means -- the whole *point* is to enable tooling (it provides an essential, albeit minor, piece of new functionality for type checkers). On Sat, Feb 13, 2021 at 2:38 AM Paul Moore <p.f.mo...@gmail.com> wrote: > I have to agree here. I'm not a frequent user of type hints yet, but I > am starting to have to maintain code that has type hints, and from a > maintenance perspective, I have to say that this would be really hard > to deal with. If I saw this for the first time "in the wild", I'd have > no idea what to do with it. > Think of it as new syntax. Of course you have to learn it (or Google it). Is it easy to learn? I think so. Is it easy to recognize once you've seen and understood it once? Yes. Is it easy to use it correctly given an example? Yes again. -- --Guido van Rossum (python.org/~guido) *Pronouns: he/him **(why is my pronoun here?)* <http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/FW3CPS553IAFIT4G27N47PW4PASNPBFK/ Code of Conduct: http://python.org/psf/codeofconduct/