python-repeatable-iterable
| A new type RepeatableIterable for Python |
|---|
| and a way to obtain one instance |
Since in Python an Iterator is an Iterable and that you cannot iterate multiple times on an iterator, you may encounter WTF bugs, even with type checking. This package provides possible solutions to this problem. See here for a discussion on this problem: https://stackoverflow.com/questions/63104689 (/what-is-the-pythonic-way-to-represent-an-iterable -that-can-be-iterated-over-mult).
Before:
def foo(iterable: Iterable):
for that in iterable:
bar(that)
for that in iterable:
# possible bug
baz(that)
foo(something)
After solution 1:
from python_repeatable_iterable import RepeatableIterable
def foo(iterable: RepeatableIterable[object]):
for that in iterable:
bar(that)
for that in iterable:
baz(that)
something_else = RepeatableIterable(something)
foo(something_else)
After solution 2:
from python_repeatable_iterable import RepeatableIterable
def foo(iterable: Iterable):
iterable = RepeatableIterable(iterable)
for that in iterable:
bar(that)
for that in iterable:
baz(that)
foo(something)
If you develop something where you have no control on what another dev might give you as input, you have 2 possibilities:
- hope for the best ;),
- or harden your code to have less support work to do :).
This applies if you dev something that is:
- closed source or open source,
- available to everyone on the Internet, available only to customers or colleagues that you may personally know or not.
Solution 2 above is a nice solution with a reasonable performance cost :).
Metadata
Release files for python-repeatable-iterable 2.1.8
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 |
|---|---|---|---|---|
| python_repeatable_iterable-2.1.8.tar.gz | 104.3 kB | Without provenance | Details for python_repeatable_iterable-2.1.8.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| python_repeatable_iterable-2.1.8-py3-none-any.whl | Python 3 | none | any | Details for python_repeatable_iterable-2.1.8-py3-none-any.whl |
Total release size: 127.0 kB
Release files / python_repeatable_iterable-2.1.8.tar.gz
| Download URL | python_repeatable_iterable-2.1.8.tar.gz |
|---|---|
| Size | 104.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0851055596ec500b5829215d0ab1dbb8179e6d8a6ae0117366745a56e576a501
|
|
BLAKE2b-256 checksum How to use checksums |
baa826244c4958a0d009fdfedc898e1b207b4cebe1a53b7f4b3666e1f2dad2b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.6
|
Release files / python_repeatable_iterable-2.1.8-py3-none-any.whl
| Download URL | python_repeatable_iterable-2.1.8-py3-none-any.whl |
|---|---|
| Size | 22.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
174a25c69d9ac0769c0f82f5aa1988c91ec00cf665a535c8ecc4bb3bd6c5217c
|
|
BLAKE2b-256 checksum How to use checksums |
9256fd66b5e6d37072cf0d1ab47c977a7e70b22d0b03f53560351d8360075e26
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.6
|
Security for python-repeatable-iterable 2.1.8
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.