Skip to main content

a type constraint tool for python function

Project description


from type_constraint import BasicCheck, CheckMeta, Check

class A: ….__metaclass__ = CheckMeta() ….def f(self, i, j): ……..””” ……..@param i str ……..@param j str ……..””” ……..return i + j

a = A() a.f(‘1’, ‘2’) “”” result is: 12 “””

@BasicCheck def test_func(i, j): ….””” ….this is a test function for type constraint …. ….@param i int :this is the first operand ….@param j float :this is the second operand …. ….@return float ….””” ….return i / j

test_func(3, 1.1) “”” result is: 2.72727272727 “””

test_func(3, 4) “”” result is: TypeError: argument:j should be <type ‘float’>, not <type ‘int’>. “””

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 type_constraint, version 0.0.3
Filename, size File type Python version Upload date Hashes
Filename, size type_constraint-0.0.3-py2.7.egg (4.8 kB) File type Egg Python version 2.7 Upload date Hashes View
Filename, size type_constraint-0.0.3.tar.gz (2.4 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