谓词工厂、函数和部分的集合,用于函数式编程。
predicates的Python项目详细描述
谓词工厂、函数和部分的集合,用于 函数式编程。
predicates模块提供各种谓词,谓词 工厂和谓词部分。
“A predicate is a function that returns the truth value of some condition.”
—Andrew M. Kuchling, Python Functional Programming HOWTO
谓词工厂是创建新谓词的函数 基于它们的参数(例如_and,_nargs)。谓词 部分是由 谓词的参数。
完整的project documentation可用。项目来源 可在github project page找到。
安装
从pypi安装:
$ pip install predicates
开发人员安装
从github repository安装开发版本:
$ git clone https://github.com/agoraplex/predicates.git predicates $ cd predicates $ virtualenv-2.7 --no-site-packages venv $ pip install -e '.[docs,tests]'
注意
请特别注意pip install行。那是一个 句点,后跟[docs,tests][1](它在 单引号以防bash误解 括号)。
使用notests运行测试套件:
$ python setup.py nosetests
使用sphinx生成html文档:
# to build in build/sphinx/html/...: $ python setup.py build_sphinx # to build in docs/_build/html/... (which is what I do): $ make -C docs
[1] | Yes, it’s a hack. See the python setup.py develop and extras thread on the python-distutils-sigmailing list). |