polyslice
Extends Python indexing with multiple slices and indices in one operation, concatenating the selections into a new sequence of the original type.
from polyslice import PolySlice
data = "0123456789"
a = PolySlice(data)[0:3, 5, -1:-3:-1]
print(a) # 012578
b = PolySlice(tuple(data))[0:3, 5, -1:-3:-1]
print(b) # ('0', '1', '2', '5', '9', '8')
c = PolySlice(list(data))[0:3, 5, -1:-3:-1]
print(c) # ['0', '1', '2', '5', '9', '8']
Interface
To make polyslice work on your own containers, implement:
class MyContainer:
def __init__(self, iterable=()) -> None:
...
def __iadd__(self, other: Self) -> Self:
...
def __getitem__(self, key: int | slice) -> object | Self:
...
Or alternatively, convert to and from polysliceble iterable (tuple, list, ...), by implementing:
class MyContainer:
def to_iterable(self) -> polysliceble_iterable:
...
@classmethod
def from_iterable(cls, iterable) -> Self:
...
Metadata
Release files for polyslice 0.0.2
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 |
|---|---|---|---|---|
| polyslice-0.0.2.tar.gz | 2.9 kB | Without provenance | Details for polyslice-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| polyslice-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for polyslice-0.0.2-py3-none-any.whl |
Total release size: 6.1 kB
Release files / polyslice-0.0.2.tar.gz
| Download URL | polyslice-0.0.2.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ab7bffeff123cf02b3259bebc055d4f125737456adebd668ca716be32827f21b
|
|
BLAKE2b-256 checksum How to use checksums |
424f892969a5ee9f991fe640554314aca8c5a70d4169385076e244ed46655db9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Release files / polyslice-0.0.2-py3-none-any.whl
| Download URL | polyslice-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
759d52e9fd85df6930243b83c310dbc8bd98b2c9c0acd86799d04ccb4ff5b366
|
|
BLAKE2b-256 checksum How to use checksums |
a6b1b5afe07e3479042fa795a2c7f6a07d30923720a5ab2dcdc3f4e51160a2fb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.3
|
Security for polyslice 0.0.2
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.