Skip to main content

A runtime type-checking module for Python

Project description

A runtime type-checking module for Python supporting both parameter-type checking and return-type checking.

The main workhorses of this module, the functions typecheck_args and typecheck_return, are used as function/method decorators (see Examples section).

Typecheck supports arbitrarily complex data-structures, able to deal with nested arrangements of tuples, lists and dictionaries.

Two utility classes, And() and Or(), are provided to assist in building more complex signatures by creating boolean expressions based on classes and/or types. A similar class, Any(), can be used to indicate that you don’t care about the type of the object.

Note that typechecking can be {en,dis}abled at runtime by toggling the typecheck.enable_checking global boolean; a value of True (the default) causes all typechecks (both for parameters and return values) to be run, while False disables them.

Project details


Download files

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

Source Distribution

typecheck-0.2.0.zip (183.6 kB view hashes)

Uploaded Source

Built Distributions

typecheck-0.2.0.win32.exe (75.8 kB view hashes)

Uploaded Source

typecheck-0.2.0-py2.4.egg (39.0 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page