Skip to main content

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


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.7.tar.gz (2.4 kB view hashes)

Uploaded Source

Built Distribution

sequence_edits-0.1.7-py3-none-any.whl (2.9 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