lookahead
Constructs a generator over the iterable yielding look-ahead (and/or “look-behind”) tuples. One tuple will be generated for each element value accessible from the iterator, containing that element and the number of elements specified just prior to and immediately after. When no such element exists, the None is used instead.
If one were to think of iterator as a list, this is would be similar to appending [None]*lookahead and prepending [None]*lookbehind, then iterating over and returning a sliding window of length lookbehind+1+ lookahead (except of course that instead of generating the such a list, this implementation generates (and caches) lookahead values only as needed).
lookahead() may be called with 1, 2, or 3 parameters:
- lookahead(iterable)
Defaults to lookahead=1, lookbehind=0
- lookahead(iterable, lookahead)
Defaults to lookbehind=0
- lookahead(iterable, lookbehind, lookahead)
Notice that lookahead is now the 3rd parameter!
Example semantics:
- lookahead(iterable):
yield (item, next)
- lookahead(iterable, 2):
yield (item, next, next+1)
- lookahead(iterable, 1, 2):
yield (prev, item, next, next+1)
- lookahead(iterable, p, n):
yeild (prev, …, prev+p-1, item, next, …, next+n-1)
Metadata
Release files for lookahead 1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| lookahead-1.0.tar.gz | 2.4 kB | Without provenance | Details for lookahead-1.0.tar.gz |
Release files / lookahead-1.0.tar.gz
| Download URL | lookahead-1.0.tar.gz |
|---|---|
| Size | 2.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a5e5ad434252db047147253f68a2c79e3434eb640bed43cf22dcf7e8de49e7c7
|
|
BLAKE2b-256 checksum How to use checksums |
2d5c13000c7e4deb6fd2e288501a9892d2a13015d06fdac319649931424f9ae2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for lookahead 1.0
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.