Archived
This project has been archived by its maintainers, and is no longer receiving any updates.
Python Circular Array Implementation
Python module implementing an indexable, double sided, auto-resizing queue data structure.
- Repositories
- grscheller.circular-array project on PyPI
- Source code on GitHub
- Detailed documentation
- Detailed API documentation on GH-Pages
Overview
Useful if used directly as an improved version of a Python List or in a "has-a" relationship when implementing other data structures.
- O(1) pushes and pops either end.
- O(1) indexing
- now fully supports slicing!
Usage
from grscheller.circular_array.ca import CA
ca = CA(1, 2, 3)
assert ca.popL() == 1
assert ca.popR() == 3
ca.pushR(42, 0)
ca.pushL(0, 1)
assert repr(ca) == 'CA(1, 0, 2, 42, 0)'
assert str(ca) == '(|1, 0, 2, 42, 0|)'
ca = CA(*range(1,11))
assert repr(ca) == 'CA(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)'
assert str(ca) == '(|1, 2, 3, 4, 5, 6, 7, 8, 9, 10|)'
assert len(ca) == 10
tup3 = ca.popLT(3)
tup4 = ca.popRT(4)
assert tup3 == (1, 2, 3)
assert tup4 == (10, 9, 8, 7)
assert ca == CA(4, 5, 6)
four, *rest = ca.popFT(1000)
assert four == 4
assert rest == [5, 6]
assert len(ca) == 0
ca = CA(1, 2, 3)
assert ca.popLD(42) == 1
assert ca.popRD(42) == 3
assert ca.popLD(42) == 2
assert ca.popRD(42) == 42
assert ca.popLD(42) == 42
assert len(ca) == 0
Metadata
Release files for grscheller.circular-array 3.8.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| grscheller_circular_array-3.8.1.tar.gz | 15.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| grscheller_circular_array-3.8.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 26.1 kB
Release files / grscheller_circular_array-3.8.1.tar.gz
| Download URL | grscheller_circular_array-3.8.1.tar.gz |
|---|---|
| Size | 15.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1fafb08121252b46a7e87028f7796dff7292527a1de7aeb36af797aca7e09b23
|
|
BLAKE2b-256 checksum How to use checksums |
aa42a23ae811320f4f7f07445d77b1730936318b0bd443f33a84626b3d32cd54
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.3
|
Release files / grscheller_circular_array-3.8.1-py3-none-any.whl
| Download URL | grscheller_circular_array-3.8.1-py3-none-any.whl |
|---|---|
| Size | 10.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d3d6a5bf548914b489802399f7889430ab72033ceca7f590231c5f2ad8ef5746
|
|
BLAKE2b-256 checksum How to use checksums |
4f621bda3ada964a5457f8cb2546126d30ff31a842ef9e494d49f7197307ec28
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
python-requests/2.32.3
|