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.1.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file tset-0.1.1.tar.gz.

File metadata

  • Download URL: tset-0.1.1.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for tset-0.1.1.tar.gz
Algorithm Hash digest
SHA256 7af737b201fed19fbe6606c335f2c6ecf0e41015e6fbe4606ea64ad8bccd9bac
MD5 5bd18d9ed2e5e45b873c71141174ce13
BLAKE2b-256 86ea63b86f917478fbee56fd38d730cff936e5e30b95f8012f7b535f408a042d

See more details on using hashes here.

Supported by

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