Skip to main content

Strict hint provides a way to do runtime type checks based based on type hint annotations introduced by PEP-484.

Usage is quite simple, just add type annotations to a function or method and decorate it with @strict:

from strict_hint import strict

@strict
def add(a: int: b: int) -> int:
    return a+b

If non int will be passed, a TypeError will be raised. Same will happen if function would return different type than expected.

Type checks support (for arguments and returned values):
  • all primitive type hints: int, float, list, tuple, set, dict, etc.,

  • standard interpreter types eg.: FunctionType and other,

  • tuples of types, eg: (int, float) will allow for both types to be accepted,

  • default values, also of different type than annotation: eg. a: int = None

  • used defined classes and class inheritance

Download files

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

Source Distribution

strict-hint-0.3.0.tar.gz (2.8 kB view details)

Uploaded Source

File details

Details for the file strict-hint-0.3.0.tar.gz.

File metadata

  • Download URL: strict-hint-0.3.0.tar.gz
  • Upload date:
  • Size: 2.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for strict-hint-0.3.0.tar.gz
Algorithm Hash digest
SHA256 e26f6067514eb383a59b28627a592f36afb7a2ff19d8364fedcb15075d8096a0
MD5 8f7f9de39cf76b24f723f835ba90ddcd
BLAKE2b-256 f055b07238c96085d15acc9b91b52b7e4a641b9d5cc0384aef2da6bdb36c3930

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.3.0 This release

1 file

0.2.4

1 file

0.2.3

1 file

0.2.2

1 file

0.2.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page