/pure

Optimizing decorator for pure functions

Primary LanguagePythonApache License 2.0Apache-2.0

pure PyPI version

Decorator for pure functions

Branch Build Coverage
master Build Status master Coverage Status master
develop Build Status develop Coverage Status develop

Prerequisites

Installation

    $ sudo pip install pure

Usage

In [1]: from pure import *

In [2]: @pure
   ...: def f(x):
   ...:     print('x: {}, x+1: {}'.format(x, x+1))
   ...:     return x+1
   ...: 

In [3]: f(1)
x: 1, x+1: 2
Out[3]: 2

In [4]: f(1)
Out[4]: 2