Skip to main content

Extension for iterable data types; adds boundwise bookmark iteration, enabling active item tracking/setting (type allowing)

Project description


Extension for iterable data types; adds boundwise bookmark iteration, enabling active item tracking/setting (type allowing)

Ideal for 'paging' through iterables


pip install itermark

Using Itermark

>>> from itermark import Itermark
>>> iterlist = Itermark(['zero', 'one', 'two', 'three'])
>>> iterlist.mark += 2
>>> iterlist.mark = 5   # Would put mark outside active index
'three'                 # Defaults to highest upper bound
>>> = 'new three'
'new three'

The Itermark extension adds two properties (three for dicts), and two functions to it's objects. Note that all itermark attributes are disabled if underlying iterable is empty


Acts as a bookmark index, and can be assigned a value directly (iterlist.mark = 2) or by operator assignment (iterlist.mark += 1, iterlist.mark -= 1)


Retrieves nth item from iterable where self.mark = n. Dictionary Itermarks return nth value


Dict specific, retrieves nth key from dictonary type where self.mark = n. Note that itermark was made post 3.6's insertion ordered dicts. While itermark properties still work pre 3.6, collections.OrderedDict is recommended and supported


Set mark to end value. Mark will never go above upper bound, but without calling len() user may not know what that upper bound is. Use .markend() to reliably set mark to upper bound

Supported types


Original implementation, full mark and active usage


No active assignment `


Uses iterator gen for mark and active properties. active calls and sets values, activekey calls immutable keys


Same features as a regular dict, but for pre 3.6 implementation


Sure, strings are just a list of characters


Look, I don't know who'd want bookmark iteration through a set but here ya go

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release. See tutorial on generating distribution archives.

Built Distribution

itermark-0.1.0-py3-none-any.whl (8.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page