Compressed representation of sequence edits
Project description
Sequence Edits
Compressed representation of sequence edits
Edits
class Skip:
id: int
tag = 'skip'
class Insert:
idx: int
value: T
tag = 'insert'
Edit = Skip | Insert
All edits are applied w.r.t. the original list. So, order of edits only affects the order in which values are insterted to a same index.
Usage
import sequence_edits as se
edits = [
se.Insert(idx=1, value='the'),
se.Skip(idx=4)
]
xs = ['And', 'earth', 'was', 'without', 'no', 'form']
list(se.apply(edits, xs))
# ['And', 'the', 'earth', 'was', 'without', 'form']
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sequence_edits-0.1.9.tar.gz
(2.5 kB
view hashes)
Built Distribution
Close
Hashes for sequence_edits-0.1.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 19006b4f4a64656bc5525699994e4a4037c7390baf0d1df118d26ae8326db9e1 |
|
MD5 | 320fa46d62ef2e1abd242f73b29fdd9a |
|
BLAKE2b-256 | 5cd7463a2afb3ea7f9ba46094fc3d28fc64bb293e4a9d9d97b28d62c3558d4aa |