On Tue, Nov 30, 2021 at 02:30:18PM +0000, Paul Moore wrote:

> And to be clear, it's often very non-obvious how to annotate something
> - in https://github.com/pfmoore/editables I basically gave up because
> I couldn't work out how to write a maintainable annotation for an
> argument that is "a Path, or something that can be passed to the Path
> constructor to create a Path" (it's essentially impossible without
> copy/pasting the argument annotation for the Path constructor).

I thought that type inference was supposed to solve that sort of 
problem? If the typechecker can see that an argument is passed to the 
Path constructor, it should be able to infer that it must be the same 
types as accepted by Path.

Aside: I'm a little disappointed in the way the typing ecosystem has 
developed. What I understood was that we'd get type inference like ML or 
Haskell use, so we wouldn't need to annotate *everything*, only the bits 
needed to resolve ambiguity. But what we seem to have got is typing like 
C, Pascal and Java, except gradual. Am I being unreasonable to be 
disappointed? I'm not a heavy mypy user, I just dabble with it 
occasionally, so maybe I've missed something.



> Anyway, we're *way* off topic now, and I doubt there's much that the
> SC or python-dev can do to change the community view on typing,
> anyway.

Heh. We could update PEP 8 to ban type annotations, then watch as the 
people who over-zealously apply PEP 8 to everything AND over-zealously 
insist on adding type annotations to everything have their heads 
explode.


-- 
Steve
_______________________________________________
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/Y6GOWIZV5JCOG5TP4ZZ4SVLXL4BGDJTI/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to