Skip to main content

Python Slicing Reference

Python's builtin list type allows one to pass in slices to get, set or delete a range of elements.

>>> my_list = ['a', 'b','c']
>>> my_list[0:2]
['a', 'b']
>>> my_list[0:3:2]
['a', 'b']
>>> my_list[1:3] = [1, 2]
>>> my_list
['a', 1, 2]
>>> my_list[::-1] = ['z', 'y', 'x']
>>> my_list
['x', 'y', 'z']

The slice notation using colons is infact a slice builtin, where start:stop:step is equivalent to slice(start, stop, step). This looks an awful lot like the range(start, stop, step) builtin, but 1-to-1 translating slices to ranges is not always appropiate.

I have created this package as a reference implementation of list, specifically to educate on how it deals with slices. I use Hypothesis to test my custom class listy against Python's very own list, hopefully ensuring that all situations where slicing is involved is perfectly emulated.

Metadata

Release files for slice-ref 0.0.2

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

Source distribution (sdist)

Source distribution for slice-ref 0.0.2
File Size Uploaded Provenance
slice-ref-0.0.2.tar.gz 4.5 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for slice-ref 0.0.2
File Interpreter ABI Platform
slice_ref-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 10.8 kB

Release files / slice-ref-0.0.2.tar.gz

Download URL slice-ref-0.0.2.tar.gz
Size 4.5 kB
Tags Source
SHA-256 checksum
How to use checksums
4ba5550ce7482196055da724f11fdc890aa287cf3c05e27959e2cbd498893c06
BLAKE2b-256 checksum
How to use checksums
1421c2bc83102c7f9a9d199c036243847e8f18730a95c71ed66c63ed2c9a4b73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-54-generic

Release files / slice_ref-0.0.2-py3-none-any.whl

Download URL slice_ref-0.0.2-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4346e9ef8d7b8b5606cb22ebd17847cd479f0119ce5f1fcd10216c27402603e4
BLAKE2b-256 checksum
How to use checksums
6944e352656f0eda40d6fd2495b25dd7c2e1df3731dafd653b349606aa378c84
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-54-generic

Security for slice-ref 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.

Release history Release notifications | RSS feed

This release

0.0.2 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