A dynamic type checker in Python.
Project description
dynatype
A dynamic type checker for Python.
What happens?
When you import the module, it silently decorates all your functions with a type checker.
How do I use it?
Type annotate it like you would in regular Python except using the annotation object (e.g. def f(a: dynatype.annotation(lambda x: type(x) is float or type(x) is int, lambda x: x < 0.5))
). That annotation only allows numbers less than 0.5 to be passed into the function.
What happens when an innapropriate value is passed?
A TypeError
is raised, allowing you to catch the error if you don't want the program to stop.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dynatype-0.0.1.tar.gz
(2.8 kB
view details)
Built Distribution
File details
Details for the file dynatype-0.0.1.tar.gz
.
File metadata
- Download URL: dynatype-0.0.1.tar.gz
- Upload date:
- Size: 2.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d98e7a56c071bfc78ee1668da1296912dcef3851f162060ce946973c052c9ef |
|
MD5 | 1bbdacb981c1b943a3e92dfc72ac7cdc |
|
BLAKE2b-256 | 0e13ecb795f110469fbd0352ca71d24f4215bdbeb0a1b4976e897a7e4eb09c74 |
File details
Details for the file dynatype-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: dynatype-0.0.1-py3-none-any.whl
- Upload date:
- Size: 3.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a7cc9a0c9505ae7b5ee1b97e9e64b59c667452ba48b9e306775bf90c9699c76a |
|
MD5 | cb9ab245875414ecb198687a675d08bd |
|
BLAKE2b-256 | c0746a01ff5da38408336e7b67abf9c41f91d672c96862706280f163920c20bf |