On Tue, 28 May 2019 at 16:58, Till <till.varoquaux@gmail.com> wrote:
Thanks Jakub, You're right __origin__ should point to `Annotated`. I created a pull request (https://github.com/python/typing/pull/635) that should address that.
I actually don't agree with this change. __origin__ is not a public API and we should not make internal implementation (much) more complex to simplify any public use of it. This is precisely the case why `get_origin()` and `get_args()` were just added to `typing` -- to "decouple" private and public introspection APIs. Moreover, I think _AnnotatedAlias is much more similar to _GenericAlias than to special forms like ClassVar, so it makes sense to make it a "thin" subclass of the latter. `get_origin()` and `get_args()` can be adjusted to return `Annotated` and `(int, 'some marker')`. -- Ivan