Skip to main content

time sets for Python

Project description

time set: all the states of a Python set data structure over time, without storing every complete version, and with nice ‘as-of’ (at) access.

Implementation: Currently stores the most recent version completely, so accessing the most recent version is not too slow. Accessing older versions is slower because it walks through the history. The whole thing will eventually slow down when there are tons of versions because it goes through all the version times fairly naively.

Usage

> from tset import Tset
> from datetime import datetime

> beginning = datetime.now()
> t = Tset(range(1,5))
> middle = datetime.now()
> t.value(range(3,8))

> t.value()
# {3, 4, 5, 6, 7}

> t.value(at=middle)
# {1, 2, 3, 4}

> t.value(at=beginning)
# {}

Tests

Run the tests with nosetests or python -m test.

Context

The idea of preserving data history is not unique. There is a considerable work on persistent data structures (which is quite distinct from the idea of persisting data to disk). Interesting related (and more comprehensive) implementations include ZODB’s Generational Sets, dat, and Datomic.

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

tset-0.1.tar.gz (1.7 kB view hashes)

Uploaded Source

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