Skip to main content

Guard like Haskell for Python.

Status

https://secure.travis-ci.org/mkouhei/pguard.png?branch=master https://coveralls.io/repos/mkouhei/pguard/badge.png?branch=master https://img.shields.io/pypi/v/pguard.svg Documentation Status

Requirements

  • Python 2.7 or Python 3.3 over or PyPy 2.4.0 over

Features

  • guard with lambda

  • Enable to use function or method as guard_cl statement argument.

Setup

$ pip install --user pguard
or
(venv)$ pip install pguard

Simple usage

>>> from pguard import guard
>>> from pguard import guard_cl as g
>>> (lambda n: guard(
... g(-1, n < 0),
... g(0, n == 0),
... g(1)  ## otherwise
... ))(0)
0

ChangeLog

0.2.0 (2016-04-27)

  • Supports “function” and “method” as guard_cl statement argument.

0.1.4 (2016-04-24)

  • Fixes setup.py url.

0.1.3 (2016-04-23)

  • Fixes README.

  • Adds check long-description to pre-commit hook.

0.1.2 (2016-04-23)

  • Fixes setup.py version.

0.1.1 (2016-04-23)

  • completed coverage 100%.

  • Adds sample usages.

0.1.0 (2016-04-23)

  • Initial release.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pguard-0.2.0.tar.gz (9.6 kB view details)

Uploaded Source

File details

Details for the file pguard-0.2.0.tar.gz.

File metadata

  • Download URL: pguard-0.2.0.tar.gz
  • Upload date:
  • Size: 9.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for pguard-0.2.0.tar.gz
Algorithm Hash digest
SHA256 3b439b5eaa63428455ecb143dfd4c4ee50a03d3a7f781d94c91ecd1174757617
MD5 6142f4cec209533024ae180ab3343cd2
BLAKE2b-256 2eec6710e24b1299b9d1ac6e51f070792e1c66cd4a366a386aebbbfb658a019c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page