thunderskill

@accepts decorator to check arguments types


Keywords
type decorator, python
License
MIT
Install
pip install thunderskill==0.0.5

Documentation

Install

[sudo] pip install thunderskill

Features

  • support multiple types argument
  • support None argument
  • human readable detailed exception message

Usage

>>> from accepts import accepts

>>> @accepts(arg1type,arg2type,...)

Examples

>>> @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))

Feedback GitHub followers GitHub issues