Lazy evaluation for Python.
Project description
Lazy evaluation for Python.
Usage
To use yzal:
from yzal import lazy, strict
@lazy
def add(x, y):
sum = x + y
print('Adding {:d} + {:d} = {:d}', x, y, sum)
The following only creates a Thunk, it does not run the lazy function above.
>>> sum = add(3, 7)
There are two ways to get the result of the lazy evaluation. The first is simply to perform an operation that requires a strict value.
>>> 5 + sum
Adding 3 + 7 = 10
15
The second way is to explicitly request a strict value.
>>> sum = add(3, 7)
>>> strict(sum)
Adding 3 + 7 = 10
10
Requirements
Python 3.4 or greater
Installation
yzal is on PyPI so the best way to install it is:
$ pip install yzal
Thanks
We wish to thank the following projects, without which yzal would have been much harder to write:
lazy_object_proxy - A fast and thorough lazy object proxy.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file yzal-0.0.5.tar.gz
.
File metadata
- Download URL: yzal-0.0.5.tar.gz
- Upload date:
- Size: 5.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c04396ce283a408b09995e30705a3f5bd8ebb4a97a1667ae1b2daebc0c721058 |
|
MD5 | 3a59f68b668fe11abc985678787effc8 |
|
BLAKE2b-256 | aa60f670c7e6a3f4d9b65a12abef5f69fd230db16bcc55c4101bb9f98c75ea87 |
File details
Details for the file yzal-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: yzal-0.0.5-py3-none-any.whl
- Upload date:
- Size: 4.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/39.1.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.7.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c13b68181dcc707dc797b645c1e279d201faa096ba52008724a9ed59197d97a |
|
MD5 | 32198c39b244b88407650fb8c630d56c |
|
BLAKE2b-256 | 08918ce964996d7bf355772a86a1472a3ec5691388c137d9173ee22b5fe7dbf5 |