Annotating a variable without specifying its type

I’m interested to hear what people who were against PEP 727 for forcing users to use type hints to document arguments think.

Does this change things?
I personally think a separation between type hints and runtime annotations could be useful for a lot of things, and these 2 (Doc and Default) are pretty good examples of just how flexible it is.

No. While this functionality has a clear use in the thread, the issues with Annotations for documentation were intrinsic

  1. Handling -OO no longer works
  2. Docuemntation is for users, not for machines, and the example use was significantly worse for users in multiple ways than existing solutions, largely by nature of how the documentation ended up sliced up.
1 Like

If python only supported intersection types you do this pretty easily, at least when the other types are explicit:

type Default = Annotated[Any, 'DEFAULT']

x: int & Default = 123

Though allowing something like Annotated[..., 'DEFAULT'] would be better.