Reference implementation of Python's list slicing resolution
Project description
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file slice-ref-0.0.2.tar.gz.
File metadata
- Download URL: slice-ref-0.0.2.tar.gz
- Upload date:
- Size: 4.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-54-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4ba5550ce7482196055da724f11fdc890aa287cf3c05e27959e2cbd498893c06
|
|
| MD5 |
079103a951b31079ea2c2a313bb0358c
|
|
| BLAKE2b-256 |
1421c2bc83102c7f9a9d199c036243847e8f18730a95c71ed66c63ed2c9a4b73
|
File details
Details for the file slice_ref-0.0.2-py3-none-any.whl.
File metadata
- Download URL: slice_ref-0.0.2-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.4 CPython/3.8.5 Linux/5.4.0-54-generic
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4346e9ef8d7b8b5606cb22ebd17847cd479f0119ce5f1fcd10216c27402603e4
|
|
| MD5 |
a63f4c6527d0e5d39fd5622b7a68ce01
|
|
| BLAKE2b-256 |
6944e352656f0eda40d6fd2495b25dd7c2e1df3731dafd653b349606aa378c84
|