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.

Filename, size & hash SHA256 hash help File type Python version Upload date
typecheck-0.2.0-py2.4.egg (39.0 kB) Copy SHA256 hash SHA256 Egg 2.4
typecheck-0.2.0.win32.exe (75.8 kB) Copy SHA256 hash SHA256 Windows Installer 2.4
typecheck-0.2.0.zip (183.6 kB) Copy SHA256 hash SHA256 Source None

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page