fosstodon.org is one of the many independent Mastodon servers you can use to participate in the fediverse.
Fosstodon is an invite only Mastodon instance that is open to those who are interested in technology; particularly free & open source software. If you wish to join, contact us for an invite.

Administered by:

Server stats:

10K
active users

Bob Belderbos

You can use typing.get_type_hints() (or __annotations__) to get the type annotations of an object.

@bbelderbos is that very different from type()? Does it provide nested types like List[Dict[str, int]] ? That would be nice…

@rhgrouls it is yes, type just says it's a function.

And yes it works with nested type hints - see image.

@bbelderbos and once you have, typing.get_args() to get the arguments to types like Union.