@accepts decorator to check arguments types
Project description
Install
[sudo] pip install accepts
Features
support multiple types argument
support None argument
human readable detailed exception message
Usage
>>> from accepts import accepts
>>> @accepts(arg1type,arg2type,...)
Example
>>> @accepts(int)
def inc(value):
return value+1
>>> inc(1) # ok
>>> inc(1.5) # exception
TypeError: ....
# multiple types
>>> @accepts((int,float))
# None
>>> @accepts((int,float,None))
Sources:
russianidiot.github.io/python/ - Python packages
russianidiot.github.io/cli/ - command line scripts
README.rst - generated with readmemako.py (python+ mako templates) and .README dotfiles
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
accepts-0.0.5.tar.gz
(7.3 kB
view hashes)