Skip to content

Latest commit

 

History

History
25 lines (21 loc) · 697 Bytes

README.rst

File metadata and controls

25 lines (21 loc) · 697 Bytes
https://travis-ci.org/scotchka/lazy_arithmetic.svg?branch=master https://coveralls.io/repos/github/scotchka/lazy_arithmetic/badge.svg?branch=master

Lazy Arithmetic

Implement lazy evaluation in Python.

>>> from lazy import LazyBase
>>> class LazyInteger(LazyBase):
...     _type = int
...     _operators = ('__add__', '__mul__')
...
>>> two = LazyInteger.lazify(2)
>>> three = LazyInteger.lazify(3)
>>> five = two + three
>>> five.value
5
>>> six = two * three
>>> six.value
6