Skip to main content

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

Thanks

We wish to thank the following projects, without which yzal would have been much harder to write:

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

yzal-0.0.2.tar.gz (3.0 kB view hashes)

Uploaded Source

Built Distribution

yzal-0.0.2-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page