Skip to main content
Join the official 2020 Python Developers SurveyStart the survey!

Python typing compatibility library

Project description

typing-compat

Python typing compatibility library


In Python >=3.8 the typing.get_origin and typing.get_args functions are provided. This library aims to bring the identical behaviour of these functions to other versions of Python.

Getting started

pip install typing-compat

Usage

>>> from typing import List, Tuple, TypeVar
>>> from typing_compat import get_args, get_origin
>>> T = TypeVar('T')

>>> tp = List[Tuple[T, T]][int]

>>> get_args(tp)
(typing.Tuple[int, int],)

>>> get_origin(tp)
<class 'list'>

License

This library is licensed under either of

at your option.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for typing-compat, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size typing_compat-0.1.0-py2.py3-none-any.whl (7.9 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size typing-compat-0.1.0.tar.gz (3.5 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page