Cython wrapper around GrailSort (https://github.com/gaming32/GrailSort-Maintained)
Project description
Join the Discord channel for live tech support!
GrailSort for Python
GrailSort for Python is a Python API for the GrailSort algorithm.
Installation
You can install GrailSort for Python from source:
$ git clone https://github.com/gaming32/grailsort
$ cd grailsort
$ python setup.py install
Or you can install it from PyPI:
$ python -m pip install GrailSort
Usage
GrailSort for Python comes with two modules: a strict one, and a slower one. The strict module (cGrailSort
) only deals with array.array('d')
objects, while the slower module (grailsort
) deals with any Python sequence that contains comparable objects.
It is generally unnescessary to deal with the grailsort
module, as you might as well use the built-in list.sort
method or the sorted
function. However, TimSort is not in-place, while GrailSort is. cGrailSort
is useful when you need to sort with speed.
Example
grailsort
import grailsort
import random
def print_out_of_order_index():
index = next((i for i in range(len(l) - 1) if l[i] > l[i + 1]), None)
print('Out of order index:', index)
l = list(range(1024))
print_out_of_order_index()
random.shuffle(l)
print_out_of_order_index()
grailsort.grailsort(l)
print_out_of_order_index()
cGrailSort
import cGrailSort
import array
import random
def print_out_of_order_index():
index = next((i for i in range(len(a) - 1) if a[i] > a[i + 1]), None)
print('Out of order index:', index)
a = array.array('d', range(1024))
print_out_of_order_index()
random.shuffle(a)
print_out_of_order_index()
cGrailSort.grailsort(a)
print_out_of_order_index()
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 Distributions
File details
Details for the file GrailSort-1.2.2.tar.gz
.
File metadata
- Download URL: GrailSort-1.2.2.tar.gz
- Upload date:
- Size: 140.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 91c9757cfb55d2be0856794a4d5ee05684aa5d8725f7a887212af2f69741999e |
|
MD5 | 5e04596c5c2f664d6b1ee7645f00f82a |
|
BLAKE2b-256 | 42f09242784eeb26e32c8c5dfaa7d2dcdb968fcc9dd8ed32fca80d9d76c6d0c5 |
File details
Details for the file GrailSort-1.2.2-cp39-cp39-win_amd64.whl
.
File metadata
- Download URL: GrailSort-1.2.2-cp39-cp39-win_amd64.whl
- Upload date:
- Size: 103.6 kB
- Tags: CPython 3.9, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f53bb11598f7ad91f9f24605c2ef99f2878cacac7899b24e80b7339d02a0ed3 |
|
MD5 | 7691f1459189e69790fc8cc325211e48 |
|
BLAKE2b-256 | c1ac3a443cd1b2bdb10ce2bac8a15c394ff9c451b026291a65c0b956b8d054aa |
File details
Details for the file GrailSort-1.2.2-cp38-cp38-win_amd64.whl
.
File metadata
- Download URL: GrailSort-1.2.2-cp38-cp38-win_amd64.whl
- Upload date:
- Size: 103.8 kB
- Tags: CPython 3.8, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69e69bed6bb7152a37e837c143f115751a65bfa303c30c877ded08e921257fc7 |
|
MD5 | aa4c5295a1d2ba2011b9986f97f625a1 |
|
BLAKE2b-256 | bea6f8d5a92df312d2f5addcaa54b2854839665c9f705330434b01ba342cff46 |
File details
Details for the file GrailSort-1.2.2-cp38-cp38-manylinux1_x86_64.whl
.
File metadata
- Download URL: GrailSort-1.2.2-cp38-cp38-manylinux1_x86_64.whl
- Upload date:
- Size: 473.5 kB
- Tags: CPython 3.8
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 17872b62e64434f3a73980bf00f8be11dd0045892fb740716a5dc02614e43c93 |
|
MD5 | 3bbaea65ddf326a1d6514d33391d4976 |
|
BLAKE2b-256 | 01075e54a6b7f22c6a29c77e68756575fddf09b14e6516f3e865a5113857e4c1 |
File details
Details for the file GrailSort-1.2.2-cp37-cp37m-win_amd64.whl
.
File metadata
- Download URL: GrailSort-1.2.2-cp37-cp37m-win_amd64.whl
- Upload date:
- Size: 102.8 kB
- Tags: CPython 3.7m, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ccbe6786fc67ad7d7c2e13a6dc7f46c960180c15150f629dd238a0ca3bbfc49 |
|
MD5 | fd93c53664a771a5028ef2f6d13f992f |
|
BLAKE2b-256 | e0142b233982832205874739806a4df0b2413afeb5dc67892feae97a6dd4303b |