a type constraint tool for python function
Project description
"""
Example:
"""
from type_constraint import BasicCheck, CheckMeta, Check
@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'>.
"""
Example:
"""
from type_constraint import BasicCheck, CheckMeta, Check
@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
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
type_constraint-0.0.1.tar.gz
(2.3 kB
view hashes)