Skip to content

Instantly share code, notes, and snippets.

View ramraj07's full-sized avatar

Ramraj Velmurugan ramraj07

View GitHub Profile
@ramraj07
ramraj07 / type_checking.py
Last active June 23, 2020 06:31
Check the complex type of any python object using the typing module
import typing
def check_type(obj: typing.Any, type_to_check: typing.Any, _external=True) -> None:
"""
Check the type of any nested object, as definable using the typing module.
Currently supports List, Dict, Union, Optional options from the typing module.
Examples:
>>> from typing import List, Dict, Union, Type, Optional