![](https://secure.gravatar.com/avatar/f69b46619a23b64a1184bd038bfa8de5.jpg?s=120&d=mm&r=g)
On 2 Jun 2019, at 02:29, Ivan Levkivskyi <levkivskyi@gmail.com> wrote:
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')`.
I imagine it’s too late to change the functions’ names? I believe something like get_generic_type instead of get_origin and get_generic_args instead of get_args would be *slightly* easier to understand for newcomers. Best, Jakub