
Paul Moore wrote:
More hazy memories here, but I think the original proposal left open the possibility of annotations not being types at all - for example, being docstrings for the arguments, or option names for a "function call to CLI" tool, etc.
Absolutely. While it was clear that Guido's own use cases were about typing, annotations were explicitly not limited to typing, which is one reason why some of the later changes have felt to some people like bait and switch. Maybe it is already too late to avoid that.
... the expectation was that annotations would be *types*,
Even from the start, it was assumed that they would be objects. (Specifically types was expected to be common, but not universal.) The particular way strings are being substituted for evaluated objects has sometimes reminded me of raising a string instead of an exception class/object. It will work, but it can seem sloppy, and it can be annoying if you were assuming otherwise and suddenly have to add a bunch of evals. (That said, I haven't yet been sufficiently motivated to even tease out exactly what the problems are, let alone to propose an alternative that also satisfies the typing fans -- in part because it feels like the obvious optimization is to just not run typing, and it isn't clear what middle grounds are generally worthwhile.)
... personally, I have the same discomfort about using explicit string annotations for forward references, it feels like I'm not declaring a "proper type". If what I say above is right, the debate here isn't about whether annotations "are for types", but rather about whether reading the types in annotations and using them to affect behaviour *at runtime* is a legitimate use of annotations.
I see that as a second dispute, which I had previously missed. I think you're right, though. On the other hand, I'm not sure the solution to both isn't just a helper function that does the 2nd-pass resolution -- preferably without requiring that all the rest of typing be imported, since even the people who want to use the typing package agree that importing it is not lightweight.
... I lurk on the typing-sig, and from an outsider's perspective, the participants seem to be almost entirely designers or heavy users of static type checkers. That gives a certain emphasis to the proposals coming from that group.
At times, it sort of reminds me of OWL and "Semantic Web". There are plenty of people who will want to use annotations as a tool, but won't be willing to wade through what can feel like "How many angels can dance on the head of a pin?" discussions. That said, I'm not sure how to best reach people who just want a rough-and-ready usually-good-enough tool. -jJ