Skip to main content

A "fast-forward and rewind" custom iterator for flexible traversal through iterables

Tested against Windows / Python 3.11 / Anaconda

pip install loophopper

from loophopper import FFIter
# Create an FFIter object for a range iterable
l = FFIter(range(40), ignore_exceptions=True, exception_replacement=None)
for no in l:
	if no % 10 == 0:
		print(f"number: {no}, 2 forward: {l.forward(2)}")
	if no % 7 == 0:
		print(f"number: {no}, 1 back: {l.back(1)}")

# Create an FFIter object for a dictionary iterable
l = FFIter(
	{k: k * 2 for k in range(40)}, ignore_exceptions=True, exception_replacement=None
)
for no in l:
	if no[0] % 10 == 0:
		print(f"number: {no}, 2 forward: {l.forward(2)}")
	if no[1] % 7 == 0:
		print(f"number: {no}, 1 back: {l.back(1)}")

l = FFIter(
	{k: k * 2 for k in range(40)}, ignore_exceptions=True, exception_replacement=None
)
for no in l:
	if l.active_index%5==0:
		print(f'{l.active_index}: {no}')

# number: 0, 2 forward: 2
# number: 0, 1 back: None
# number: 7, 1 back: 6
# number: 10, 2 forward: 12
# number: 14, 1 back: 13
# number: 20, 2 forward: 22
# number: 21, 1 back: 20
# number: 28, 1 back: 27
# number: 30, 2 forward: 32
# number: 35, 1 back: 34
# number: (0, 0), 2 forward: (2, 4)
# number: (0, 0), 1 back: None
# number: (7, 14), 1 back: (6, 12)
# number: (10, 20), 2 forward: (12, 24)
# number: (14, 28), 1 back: (13, 26)
# number: (20, 40), 2 forward: (22, 44)
# number: (21, 42), 1 back: (20, 40)
# number: (28, 56), 1 back: (27, 54)
# number: (30, 60), 2 forward: (32, 64)
# number: (35, 70), 1 back: (34, 68)
# 0: (0, 0)
# 5: (5, 10)
# 10: (10, 20)
# 15: (15, 30)
# 20: (20, 40)
# 25: (25, 50)
# 30: (30, 60)
# 35: (35, 70)

Metadata

Release files for loophopper 0.10

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for loophopper 0.10
File Size Uploaded Provenance Actions
loophopper-0.10.tar.gz 4.3 kB Without provenance Details for loophopper-0.10.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for loophopper 0.10
File Interpreter ABI Platform Actions
loophopper-0.10-py3-none-any.whl Python 3 none any Details for loophopper-0.10-py3-none-any.whl

Total release size: 9.8 kB

Release files / loophopper-0.10.tar.gz

Download URL loophopper-0.10.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
dc2fa0d20b987e23377ab9a480784fc63efef9e4371c867906e8d00cafd97a05
BLAKE2b-256 checksum
How to use checksums
302dfc6d06511239a52ccd1dbb52ebf625bca1f58c344b61dba4f830f9e83a0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Release files / loophopper-0.10-py3-none-any.whl

Download URL loophopper-0.10-py3-none-any.whl
Size 5.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6417654607930912d67a4685e6faffdc3ea4a543bfd2e69ebd963b455816967e
BLAKE2b-256 checksum
How to use checksums
1e88cdf7c91316337ddee80cd0e94073722005cd4af41dbafff5179ab77b12c0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.5

Security for loophopper 0.10

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.10 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page