Skip to content
Branch: develop
Go to file
Code

Latest commit

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.rst

Succession

Build Status Coverage

A python library providing a useful abstraction for recording state transitions, compressing them, and distributing to multiple listeners.

Usage

Compression

The :class:`Succession` class provides a way to reduce long chains of updates down to a reduced chain with the same effect.

For example, assume that you only care about the sum of the numbers pushed to a succession, and that it's fine to replace all of the numbers from before you started listening with the current total. You can do something like the following:

>>> succession = Succession(compress=lambda items: [sum(items)])
<succession.Succession object at 0x7f5a65a10518>
>>> from_start = succession.iter()
>>> for i in [1, 2, 3, 4, 5]:
...     succession.push(i)
... succession.close()
>>> from_end = succession.iter()
>>> list(from_start)
[1, 2, 3, 4, 5])
>>> list(from_end)
[15]

Iterators forked earlier will not miss any transitions added from the time they were created. Compression is only applied to transitions before the fork.

Installation

Recommended method is to use the version from pypi

pip install succession

Links

License

The project is licensed under the BSD license. See LICENSE for details.

About

A python library providing concurrent push based lazy linked lists

Resources

License

Languages

You can’t perform that action at this time.